home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / adaed.lzh / Ada / Examples / Prime.ada < prev    next >
Encoding:
Text File  |  1992-03-01  |  1002 b   |  44 lines

  1. -- From d0micke@dtek.chalmers.se Fri Feb 28 11:50:45 1992
  2.  
  3.  
  4. with  text_io;
  5. use text_io;
  6.  
  7.  
  8. procedure MICKE is
  9.     package basic_num_io is new integer_io(integer);
  10.     use   basic_num_io;
  11.     IND: array (2..1000) of NATURAL;
  12.     PTR: INTEGER :=2;
  13.     ANT: INTEGER :=2;
  14.     T: INTEGER :=0;
  15.     TR: INTEGER:=4;
  16. begin
  17.     while ANT/=0 loop
  18.         new_line;
  19.         put("Give me the highest number to test (max 1000): ");
  20.         get(ANT);
  21.         while PTR<=ANT loop
  22.             T:=PTR;
  23.             while T<=ANT loop
  24.                 T:=T+PTR;
  25.                 if T<1000 then IND(T):=1;
  26.                 end if;
  27.             end loop;
  28.             while TR=4 loop
  29.                 PTR:=PTR+1;
  30.                 exit when PTR>=1000;
  31.                 exit when IND(PTR)=0;
  32.             end loop;
  33.         end loop;
  34.         for I in 2..ANT loop
  35.             if IND(I)=0 then put(I);
  36.             new_line;
  37.             end if;
  38.             IND(I):=0;
  39.         end loop;
  40.         PTR:=2;
  41.         T:=0;
  42.     end loop;
  43. end MICKE;
  44.