Write a program: Calculate the sum of even and odd numbers separately, entered from the keyboard.
July 29, 2021 | education
| program zz1;
var n, a, s1, s2, i: integer; // introduce variables of integer type
begin
write (‘enter a number’); // enter the number of entered numbers from the keyboard
read (n);
for i: = 1 to n do
begin
read (a);
if a mod 2 = 0 then s1: = s1 + a else s2: = s2 + a;
end;
writeln (‘the sum of even numbers =’, s1);
write (‘sum of odd numbers =’, s2);
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.