-- This program calculates the sum of squares.
-- Author: John Weber
with Ada.Text_Io, Ada.Integer_Text_Io;
use Ada.Text_Io, Ada.Integer_Text_Io;
-- Ada 95: From The Beginning
-- Chapter 2, Problem 1
procedure Ch2Problem1 is
   N : Integer := 0;
   Sum:Integer := 0;
   i : Integer := 0;
begin
   Put("Enter n: ");
   Get(N);
   if ( N < 0 ) then
      Put("Invalid Input. N must be positive."); New_Line;
      return;
   end if;
   for i in 0 .. N loop
      Sum := Sum + (i**2);
   end loop;
   Put("Value: ");
   Put(Sum); New_Line;
end Ch2Problem1;

