The Ada Program: nested.adb

  1 -- nested.adb:  print multiplication table using nested "for" loops
  2 
  3 with Ada.Text_IO, Ada.Integer_Text_IO;
  4 use Ada;
  5 
  6 procedure Nested is
  7 
  8    N: constant Integer := 5;
  9    M: constant Integer := 3;
 10 
 11 begin
 12 
 13    Outer: for I in 1 .. N loop
 14 
 15       -- Print each row of the table on one line.
 16       Inner: for J in 1 .. M loop
 17          Integer_Text_IO.Put (I, Width=>3);
 18          Text_IO.Put (" × ");
 19          Integer_Text_IO.Put (J, Width=>3);
 20          Text_IO.Put (" = ");
 21          Integer_Text_IO.Put (I*J, Width=>3);
 22          Text_IO.Put ("  ");
 23       end loop Inner;
 24       Text_IO.New_Line;
 25 
 26    end loop Outer;
 27 
 28 end Nested;