Copyright 1984 by ABComputing					   May 15, 1984


	  -- this program finds	the average of two numbers

	  with TEXT_IO;	use TEXT_IO;
	  procedure AVERAGE is
	     package INT_IO is new TEXT_IO.INTEGER_IO (integer);
	     use INT_IO;
	     FIRST_NUMBER:	   integer;
	     SECOND_NUMBER:	   integer;
	     AVG:		   integer;
	  begin
	     put ("Enter a number: ");
	     NEW_LINE;
	     get (FIRST_NUMBER);
	     put ("And another number: ");
	     NEW_LINE;
	     get (SECOND_NUMBER);
	     AVG := (FIRST_NUMBER + SECOND_NUMBER) / 2;
	     put ("The average is: ");
	     NEW_LINE;
	     put (AVG);
	  end AVERAGE;


	  -- this program demonstrates some features of	numeric
	  -- data types	and expressions

	  procedure PLAY_WITH_NUMBERS is
	     X:	integer;
	  begin
	     --	the first two statements in this program
	     --	demonstrate how	different numeric notations
	     --	can be combined	in one expression
	     X := 10000	+ 10_000;    --	X equals 20000
	     X := 5 + 8#24#;	     --	X equals 25
	     --	the next statement demonstrates	integer	division
	     X := 3 / 2;	     --	X equals 1
	     --	now let's see some type conversion
	     X := 2 * integer (2.7); --	X equals 6
	  end PLAY_WITH_NUMBERS;


	  -- this procedure is the Ada version of the Byte magazine
	  -- standard benchmark	- the sieve of Erastosthenes


	  with TEXT_IO;	use TEXT_IO;
	  procedure SIEVE is
	     package INT_IO is new TEXT_IO.INTEGER_IO (integer);
	     use INT_IO;
	     SIZE:  constant integer :=	8190;
	     FLAGS: array (0..SIZE) of Boolean;
	     K:	    integer;
	     PRIME: integer;
	     COUNT: integer;
	  begin
	     put ("10 iterations");
	     NEW_LINE;
	     for ITERATIONS in 1..10 loop
		 COUNT := 0;
		 FLAGS := (1..SIZE => true);
		 for I in 0..SIZE loop
		     if	FLAGS(I) then
			PRIME := I + I + 3;
			K := I + PRIME;
			while K	<= SIZE	loop
			      FLAGS(K) := false;
			      K	:= K + PRIME;
			end loop;
			COUNT := COUNT + 1;
		     end if;
		 end loop; -- I	loop
	     end loop; -- ITERATIONS loop
	     put (COUNT);
	     put (" primes");
	  end SIEVE;




		     ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
		     ³ File Name:  ÛÛ	list1.ada   ÛÛ	³
		     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
