Unformatted text preview: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end a b c 16 12 7 remainder(16, 7) 2 0
remainder(12, 7) 5 0 Demo of "Greatest Common Factor"
1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end a b c 16 12 6 remainder(16, 6) 4 0
remainder(12, 6) 0 Demo of "Greatest Common Factor"
1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end a b c 16 12 5 remainder(16, 5) 1 0
remainder(12, 5) 2 0 Demo of "Greatest Common Factor"
1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end a b c 16 12 4 remainder(16, 4) 0
remainder(12, 4) 0 Demo of "Greatest Common Factor"
1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end a b c 16 12 4 remainder(16, 4) 0
remainder(12, 4) output 4 0 News Flash! Meet Apple's new holiday lineup News Flash! News Flash! $79 $149 4GB $249 80GB $199 8GB $349 160GB $299 8GB $399 16GB What?!? $399 8GB News Flash! Multitouch interface 3.5 inch widescreen 802.11 b/g WiFi with Safari 8GB or 16GB Flash Storage YouTube WiFi iTunes Starbucks integration (lame?) No email or camera News Flash! From the Associated Press on the iPhone price cut: "Apple stock dropped more than 5 percent after the price drop was announced, losing $7.40 to close at $136.76." "People who bought the iPhone w...
View
Full Document
 Fall '07
 Ringenberg
 Algorithms, Elementary arithmetic, Greatest common divisor, Least common multiple, Lowest common denominator

Click to edit the document details