uses crt;
var a,i,t:integer;
N: array[1..300] of integer;
begin
clrscr;
write('nhap so a: '); readln(a);
t:=0;
for i:=1 to a do
begin
writeln('N[',i,']= '); readln(N[i]);
if N[i] mod 2<>0 then t:=t+N[i];
end;
writeln('tong cac so le trong mang la: ',t);
readln;
end.
Đúng 1
Bình luận (0)
uses crt;
var a:array[1..300]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
readln;
end.
Đúng 0
Bình luận (0)