Write a program that enters the natural numbers a and b and outputs the sum of the squares of the natural
September 3, 2021 | education
| Write a program that enters the natural numbers a and b and outputs the sum of the squares of the natural numbers in the range a through b.
program sum_sqr;
var a, b: integer;
s: real;
begin
writeln (‘Enter two numbers separated by a space’);
readln (a, b);
if a> b then // If a is greater than b, then a and b exchange values
begin
s: = 0;
b: = b + a;
a: = b-a;
b: = b-a;
end;
for i: integer: = a to b do s: = s + power (i, 2);
writeln (s)
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.