finished 19 (not fully tested...)
[williamcminus.git] / assign6 / loops.txt
blob81a3dc6b7623f1cd56693a21c592e71f661c152c
1 BEGIN\r
2     BEGIN {Calculate a square root using Newton's method.}\r
3         number := 4;\r
4         root := number;\r
5 \r
6         REPEAT\r
7             root := (number/root + root)/2\r
8         UNTIL root*root - number < 0.000001\r
9     END;\r
11     BEGIN {Calculate a square root using Newton's method.}\r
12         number := 2;\r
13         root := number;\r
15         WHILE root*root - number > 0.000001 DO BEGIN\r
16             root := (number/root + root)/2\r
17         END\r
18     END;\r
20     FOR i := 1 TO 5 DO BEGIN\r
21         j := i;\r
22     END;\r
24     FOR k := j DOWNTO 1 DO n := k;\r
26     FOR i := 1 TO 2 DO BEGIN\r
27         FOR j := 1 TO 3 DO BEGIN\r
28             k := i*j\r
29         END\r
30     END\r
31 END.\r