-- Sample1.adb -- Sample of a simple Ada program that reads an integer, -- and prints = mod ( , 10 ) with Ada.Text_IO ; use Ada.Text_IO ; -- The 'with' and 'use' make available the -- language defined text input/output procedure Sample1 is package Int_IO is new Integer_IO ( Integer ) ; -- Get & Put now available use Int_IO ; -- for integers User_Number : Integer ; -- Every object must be declared with its type Result : Integer ; begin << Again >> -- Statement label for the goto, YUK! never use goto again Get ( User_Number ) ; -- Reads an integer into integer object User_Number Result := User_Number mod 10 ; -- Compute mod 10 Put ( Result ) ; -- Writes just digits of result Put ( " = mod (" ) ; -- Writes characters in quotes Put ( User_Number ) ; -- Writes just digits of User_Number Put_Line ( ", 10)" ) ; -- Writes characters in quotes and ends line goto Again ; end Sample1 ; -- compiled and executed with the following commands (without "--"): -- -- gcc -c sample1.adb -- gnatbl sample1.ali -- sample1 -- 25 -- -- output looked something like: -- 5 = mod ( 25, 10) -- -- ^Z for DOS and VMS or ^D for Unix -- raised ADA.IO_EXCEPTIONS.DATA_ERROR -- -- P.S. files can be obtained from -- ftp://www.csee.umbc.edu/~squire/www/adaclass/download