program SumElements;
const
N = 5;
var
C: array[1..N] of integer;
i, sum: integer;
begin
sum := 0;
for i := 1 to N do
readln(C[i]);
if (C[i] > 4) and (C[i] mod 6 = 0) then
sum := sum + C[i];
end;
writeln('Sum of elements that are greater than 4 and divisible by 6: ', sum);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program SumElements;
const
N = 5;
var
C: array[1..N] of integer;
i, sum: integer;
begin
sum := 0;
for i := 1 to N do
begin
readln(C[i]);
if (C[i] > 4) and (C[i] mod 6 = 0) then
sum := sum + C[i];
end;
writeln('Sum of elements that are greater than 4 and divisible by 6: ', sum);
end.