Write an ABC Pascal program that calculates the sum of all even numbers in the range from 1 to n.
September 14, 2021 | education
| program summa_chetnyh;
var i, sum: integer;
begin
writeln (‘Enter the last number to complete the account’);
readln (n);
for i: = 1 to n do if i div 2 = 0 then sum: = sum + i;
writeln (‘The sum of all even numbers from 1 to’, n, ‘is:’, sum);
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.