progs/primes.while
changeset 742 b5b5583a3a08
parent 741 e66bd5c563eb
child 743 6acabeecdf75
equal deleted inserted replaced
741:e66bd5c563eb 742:b5b5583a3a08
     1 // prints out prime numbers from
       
     2 // 2 to 100 (end)
       
     3 
       
     4 end := 100;
       
     5 n := 2;
       
     6 while (n < end) do {
       
     7   f := 2;
       
     8   tmp := 0;
       
     9   while ((f < n / 2 + 1) && (tmp == 0)) do {
       
    10     if ((n / f) * f == n) then  { tmp := 1 } else { skip };
       
    11     f := f + 1
       
    12   };
       
    13   if (tmp == 0) then { write(n) } else { skip };
       
    14   n  := n + 1
       
    15 }