with ada.text_io; use ada.text_io;

with ada.integer_text_io; use ada.integer_text_io;

procedure table1 is

    start, finish: Integer;   -- Beginning and end of table

    numberOfRows: Integer;    -- Number of rows in the table

begin
    -- Output header

    put_line("          I       I**2       I**3");
    put_line("        --------------------------");

    -- Set table beginning and end

    start := 2;
    finish := 10;

    -- Output rows
    for i in start .. finish loop

        -- Output one row
        put(i, 11);
        put(i**2, 11);
        put(i**3, 11);

        new_line;

    end loop;

    new_line;

    -- Calculate number of rows in table
    numberOfRows := finish - start + 1;

    -- Output message based on number of rows in table
    if numberOfRows <= 0 then
        put_line("Error: Start is greater than finish!");
        put_line("Start:" & Integer'image(start));
        put_line("Finish:" & Integer'image(finish));

    elsif numberOfRows = 1 then
        put_line("Start and finish are the same!");

    else
        put("Number of rows: ");
        put(numberOfRows, 1);      -- 1 is the minimum width
        new_line;

    end if;

end table1;