Write a program that finds the sum of even numbers in and the product of odd numbers in the range from 1 to 10.

The solution of the problem:
The code is written in PascalABC.NET program.
Var a: array [1..100] of integer;
i, n, sum, pr, k: integer;
begin
randomize; // Connect an arbitrary number generator.
write (‘Enter dimension n =’);
readln (n);
write (‘Arbitrary sequence:’);
k: = 0;
for i: = 1 to n do
begin
a [i]: = random (1, 10); // Generates arbitrary integers ranging from 1 to 10.
write (a [i], ”); // Display numbers separated by a space on the screen in a line.
if odd (a [i]) = true then k: = k + 1;
end;
writeln;
sum: = 0;
if k = 0 then begin
for i: = 1 to n do
begin sum: = sum + a [i]; pr: = 0;
end; end;
if k <> 0 then begin
pr: = 1;
for i: = 1 to n do
begin
if odd (a [i]) = true then pr: = pr * a [i] else sum: = sum + a [i];
end; end;
writeln (‘Answer: the sum of even numbers =’, sum);
writeln (‘Answer: the product of odd numbers =’, pr);
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.