Найдите сумму элементов массива (50 элементов из [-50; 50]) кратных 7.
Answers & Comments
Bakalavr
Program test; const n = 5; var i,sum:integer; a:array [1..n] of integer; begin for i:=1 to n do readln(a[i]); for i:=1 to n do if a[i] mod 7 =0 then sum:=sum+a[i]; writeln(sum); end.
Answers & Comments
const n = 5;
var i,sum:integer;
a:array [1..n] of integer;
begin
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
if a[i] mod 7 =0 then sum:=sum+a[i];
writeln(sum);
end.
-----------------------