# Create a program for calculating in a one-dimensional array C the product of even and positive

**Create a program for calculating in a one-dimensional array C the product of even and positive elements and the sum of elements less than 6.**

The solution of the problem:

The code is written in PascalABC.NET program.

Var C: array [1..100] of integer;

i, n, k, v, sum, p: integer;

begin

randomize; // Generator of arbitrary numbers.

write (‘Enter dimension n =’);

readln (n);

write (‘One-dimensional array:’);

k: = 0;

for i: = 1 to n do

begin

C [i]: = random (-10, 10); // Fill the array with arbitrary values.

write (C [i], ”);

if (not odd (C [i]) = true) and (C [i]> 0) then k: = k + 1;

if C [i] <6 then v: = v + 1;

end;

writeln;

if k = 0 then writeln (‘There are no even and positive elements in the array at the same time.’)

else begin

p: = 1;

for i: = 1 to n do

if (not odd (C [i]) = true) and (C [i]> 0) then p: = p * C [i];

writeln (‘The product of even and positive elements is equal to’, p);

end;

if v = 0 then writeln (‘The array has no elements less than 6.’)

else begin

sum: = 0;

for i: = 1 to n do if C [i] <6 then sum: = sum + C [i];

writeln (‘The sum of elements less than 6 is equal to’, sum);

end;

end.