Computer * Thought Ada (tm): v1.3 : 2/03/87 12:27:29 Computer * Thought ADA Line# Ada Source program 1 with TEXT_IO, CT_BASIC_IO; use TEXT_IO, CT_BASIC_IO.INT_IO; 2 procedure PRIMES is 3 4 -- package INT_IO is new INTEGER_IO(INTEGER); 5 -- use INT_IO; 6 7 NUM_PRIMES : constant := 10; 8 COUNT : INTEGER := 0; 9 10 function IS_PRIME(P : INTEGER) return BOOLEAN is 11 begin 12 13 if P < 2 then 14 return FALSE; 15 end if; 16 17 for I in 2 .. P loop 18 if I * I > P then 19 return TRUE; 20 elsif P mod I = 0 then 21 return FALSE; 22 end if; 23 end loop; 24 25 end IS_PRIME; 26 27 begin 28 29 PUT_LINE("The first " & INTEGER'image(NUM_PRIMES) & " primes are:"); 30 for P in 2 .. INTEGER'LAST loop 31 if IS_PRIME(P) then 32 PUT(INTEGER'(P)); 33 PUT(" "); 34 new_line; 35 COUNT := COUNT + 1; 36 exit when COUNT = NUM_PRIMES; 37 end if; 38 end loop; 39 40 NEW_LINE; 41 42 end PRIMES; A total of 0 syntax errors and 0 static semantic errors were detected. -- -- -- -- -- -- -- -- -- -- -- -- --