найти сумму элементов массива H(11) ,стоящих на четных местах и их количество
var
n:array [1..11] of integer;
i,k,s:integer;
begin
for i:=1 to 11 do begin
write ('N[',i,'] = ');readln(n[i]);
end;
s:=0;
k:=0;
for i:=1 to 11do
if odd(i)=true then begin
k:=k+1;
s:=s+n[i];
writeln (k);
writeln (s);
readln;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
n:array [1..11] of integer;
i,k,s:integer;
begin
for i:=1 to 11 do begin
write ('N[',i,'] = ');readln(n[i]);
end;
s:=0;
k:=0;
for i:=1 to 11do
if odd(i)=true then begin
k:=k+1;
s:=s+n[i];
end;
writeln (k);
writeln (s);
readln;
end.