Hi
Sounds like someone tried to define Pascal by using a Flow Chart and someone else converted the Flow Chart itself into english :-)
Does the Standards Committiee still exist? It would be nice to start the ball rolling tward a rewrite, even if nothing more than a conversion into real english.
In the meanwhile, just for fun patched the original program that started this thread:
program prime1; {find prime numbers up to 100} var i,j,k: integer; begin for i := 2 to 100 do begin k := 0; for j := 2 to i do if i mod j = 0 then begin k := j; break; end; if k = i then writeln( k ); end; end.
It prints out 25 prime numbers 2,3,5, ... ,97 useing 1158 passes through the inner loop.
program prime2; {find prime numbers up to 100} var i,j: integer; k: boolean; begin for i := 2 to 100 do begin k := false; j := 1; repeat inc( j ); if i mod j = 0 then k := true; until( k or ( j > sqrt( i ))); if not k or ( j = i ) then writeln( i ); end; end.
It prints out the same list useing 261 passes
Russ russwhit@mind.net