Make a program that calculates the sum of squares of numbers from 1 to n, (n is entered from the keyboard)

Make a program that calculates the sum of squares of numbers from 1 to n, (n is entered from the keyboard) if n is even, and the sum of cubes of numbers from 1 to n if n is odd. Use a WHILE loop

i, n, x, sum, count: integer;

odd: boolean;

begin
write (‘Enter the number of numbers:’);
readln (n);
sum: = 0;
count: = 0;
i: = 1;
if (n mod 2 = 1) then odd: = true else odd: = false;
while i <n do
begin
if (odd) then
begin
sum: = sum + i * i * i;
end
else
begin
sum: = sum + i * i;
end;
i: = i + 1;
end;
writeln (‘The amount is’, sum, ‘.’);
readln ();
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.