This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | sum=0 | |
| for x in range (0,1000): | |
| if x%3==0 or x%5==0: sum+=x | |
| print sum | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (define sum 0) | |
| (define (3or5 start limit inc) | |
| (if (< start limit) | |
| (begin | |
| (if (= (remainder start 3) 0) (set! sum (+ sum start)) (if (= (remainder start 5) 0) (set! sum (+ sum start)))) | |
| (3or5 (+ start inc) limit inc))) sum) | |
| (print (3or5 0 1000 1)) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | x,y,n,total=0,1,0,0 | |
| while n<=4000000: | |
| n=x+y | |
| x=y | |
| y=n | |
| if n%2==0: | |
| total+=n | |
| print total | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (define x 0) | |
| (define y 1) | |
| (define n 0) | |
| (define sum 0) | |
| (define (evenfibsum) | |
| (set! n (+ x y)) | |
| (set! x y) | |
| (set! y n) | |
| (if (= (modulo n 2) 0) (set! sum (+ sum n))) | |
| (if (<= n 4000000) (evenfibsum)) sum) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "queue.h" | |
| void init(int *head, int *tail) { | |
| *head = *tail = 0; | |
| } | |
| void push(int *q,int *tail, int element) { | |
| q[(*tail)++] = element; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | void push(int *q, int *tail, int element); | |
| int pop(int *q, int *head); | |
| int empty(int head, int tail); | |
| void init(int *head, int *tail); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <stdio.h> | |
| #include <stdlib.h> | |
| #include "queue.h" | |
| int main(int argc, char const *argv[]) | |
| { | |
| int head,tail,element; | |
| int queue[4]; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | num_word_dict={1:len("one"),2:len("two"),3:len("three"), | |
| 4:len("four"),5:len("five"), 6:len("six"),7:len("seven"), | |
| 8:len("eight"),9:len("nine"),10:len("ten"),11:len("eleven"), | |
| 12:len("twelve"),13:len("thirteen"),14:len("fourteen"), | |
| 15:len("fifteen"),16:len("sixteen"),17:len("seventeen"), | |
| 18:len("eighteen"),19:len("nineteen"),20:len("twenty"), | |
| 30:len("thirty"),40:len("fourty"),50:len("fifty"), | |
| 60:len("sixty"),70:len("seventy"),80:len("eighty"), | |
| 90:len("ninety"),100:len("onehundred"),200:len("twohundred"), | |
| 300:len("threehundred"),400:len("fourhundred"), | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def paths(n): | |
| p=1 | |
| for x in xrange(1, n+1): p=p*x | |
| return p | |
| print paths(40)/paths(20)/paths(20) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | tri_num=[ | |
| [75], | |
| [95, 64], | |
| [17, 47, 82], | |
| [18, 35, 87, 10], | |
| [20, 04, 82, 47, 65], | |
| [19, 01, 23, 75, 03, 34], | |
| [88, 02, 77, 73, 07, 63, 67], | |
| [99, 65, 04, 28, 06, 16, 70, 92], | |
| [41, 41, 26, 56, 83, 40, 80, 70, 33], | 
OlderNewer