-- Here is a program written in Ada. It compiles and works but -- is in other respects less than perfect. -- See if you can improve it. with Text_io; procedure PRIMES is -- a program to output prime numbers between 1 and 100 -- A prime is a number P that has no divisors between 2 and P-1 -- For example: 1, 2, and 3 are considered to prime. N:constant integer:=100;-- Largest number to be considered package INT_IO is new Text_IO.Integer_io(integer); --need integer output begin NUMBERS_1_TO_N: for P in 1..N loop -- For each possible prime in turn... POSSIBLE_PRIME: declare COUNT:Integer:=0; --here we have found 0 divisors begin POSSIBLE_DIVISORS: for D in 2..P-1 loop -- P is divisible by COUNT divisors in 2..D-1 if P mod D = 0 then -- P is divisible by D COUNT:=COUNT+1; -- so add 1 to COUNT end if; -- P is divisible by COUNT divisors in 2..D end loop POSSIBLE_DIVISORS; -- P is divisible by COUNT divisors in 2..P-1 if COUNT=0 then INT_IO.put(P); end if; end POSSIBLE_PRIME; end loop NUMBERS_1_TO_N; end PRIMES;