-- This program illustrates some simple array operations
--
with ada.text_io; use ada.text_io; 
with ada.integer_text_io; use ada.integer_text_io; 
 
procedure printall  is 
    MaxSize: Constant Integer := 10;
    type IntArray is array (1 .. MaxSize) of Integer;

    a: IntArray;
    n, nsquared: Integer;
begin
    -- Fill the array by reading MaxSize integers from standard input
    for i in a'range loop
        get(n);
        a(i) := n;
    end loop;

    -- Print the values in the array and their squares
    for i in a'range loop
        n := a(i); 
        nsquared := n * n;

        put(n);
        put(nsquared);
        new_line;
    end loop;
    new_line;

    -- Print the values in the array and their squares, in reverse
    for i in reverse a'range loop
        put(a(i));         -- No extra variable this time
        put(a(i) ** 2);
        new_line;
    end loop;
end printall;