Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Program HOC24;
var a: array[1..50] of integer;
i,n: byte;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Cac phan tu chan trong mang la: ');
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(a[i],' ');
t:=t+a[i];
end;
writeln;
write('Tong cac phan tu chan trong day la: ',t);
readln
end.
Program HOC24;
var i,n: byte;
t: longint:
a: array[1..50] of integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do begin write('A[',i,']='); readln(a[i]); end;
t:=0;
write('Cac phan tu chan co trong mang la: ');
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(a[i],' ');
t:=t+a[i];
end;
writeln;
write('Tong cac phan tu chan do la: ',t);
readln
end.
Program HOC24;
var i,n: integer;
a: array[1..32000] of integer;
begin
write('Nhap N:'); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
//----- cau a
write('Cac phan tu co gia tri le la: ');
for i:=1 to n do if a[i] mod 2=1 then write(a[i],' ');
//--------------
writeln;
//------cau b
write('Cac phan tu co gia tri chan la: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
//------------
readln
end.
program TongLe;
var
N, i, Tong: integer;
A: array[1..50] of integer;
begin
write('Nhap so phan tu cua mang N (N <= 50): ');
readln(N);
for i := 1 to N do
begin
write('Nhap phan tu thu ', i, ': ');
readln(A[i]);
end;
Tong := 0;
for i := 1 to N do
begin
if(A[i] mod 2 <> 0) then
begin
Tong := Tong + A[i];
end;
end;
writeln('Tong cac so le trong mang A la: ', Tong);
readln;
end.
uses crt;
var a:array[1..50]of integer;
i:byte;
begin
clrscr;
for i:=1 to 50 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 50 do
write(a[i]:4);
readln;
end.