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.
![](https://rs.olm.vn/images/avt/0.png?1311)
Var a:array[1..200] of integer;
i,n,d1,d2,s:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
Begin
If a[i] mod 2 = 0 then d1:=d1+1;
If (a[i] > 0) and (a[i] < 51) then d2:=d2+1;
End;
Writeln('Co ',d1,' so chan');
Write('Co ',d2,' so tu 1 den 50');
Readln;
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
program dem;
var
n, i, chan, le: integer;
a: array[1..1000] of integer;
begin
write('Nhap so phan tu cua day: ');
readln(n);
for i := 1 to n do
begin
write('Nhap phan tu thu ', i, ': ');
readln(a[i]);
end;
chan := 0;
le := 0;
for i := 1 to n do
begin
if (a[i] mod 2 = 0) then
chan := chan + 1
else
le := le + 1;
end;
writeln('So phan tu chan trong day la: ', chan);
writeln('So phan tu le trong day la: ', le);
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Program Tin;
Uses crt;
Var i,n,dem:Integer;
a:array[1..10000] of integer;
Begin
clrscr;
Write('Nhap do dai cua day: ');readln(n);
dem:=0;
Writeln('Nhap ',n,' phan tu cua day:');
For i:= 1 to n do
Begin
Write('So thu ',i,': ');
readln(a[i]);
If a[i] mod 2 = 1 then dem:=dem+1;
End;
Writeln('Day co ',dem,' so le');
readln;
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
program PrintEvenOdd;
var
num, even, odd, i: Integer;
begin
even := 0;
odd := 0;
for i := 1 to 5 do
begin
writeln('Nhap so thu ', i, ': ');
readln(num);
if num mod 2 = 0 then
even := even + 1
else
odd := odd + 1;
end;
writeln('Tong chan: ', even);
writeln('Tong le: ', odd);
end.
Var a:array[1..5] of integer;
i:integer;
Begin
For i:=1 to 5 do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
Writeln('Cac so chan la ');
For i:=1 to 5 do
If a[i] mod 2 = 0 then write(a[i]:8);
Writeln;
Write('Cac so le la ');
For i:=1 to 5 do
If a[i] mod 2 <> 0 then write(a[i]:8);
Readln
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
program TongChanLe;
var
n,i, chans, les: integer; a: array[1..100] of integer;
begin
chans := 0;
les := 0;
write('Nhap n: ');
readln(n);
for i:=1 to n do
begin
write('Nhap so thu ', i, ': ');
readln(a[i]);
if a[i] mod 2 = 0 then
chans := chans + a[i]
else
les := les + a[i];
end;
writeln('Tong cac so chan la: ', chans);
writeln('Tong cac so le la: ', les);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Uses crt;
var max,min,n,i,m,n: longint;
a: array[1..100] of longint
begin clrscr;
for i:=1 to n do begin
if(a[i] mod 2=0) then m:=m+a[i];
if(a[i] mod 2<>0) then n:=n+a[i];
end;
max:=a[1];
min:=a[1];
for i:=1 to n do begin
if(max<a[i]) then max:=a[i];
if(min>a[i]) then min:=a[i];
end;
Writeln('Tong cac phan tu chan: ',m);
Writeln('Tong cac phan tu le: ',n);
Writeln('Phan tu co gia tri lon nhat: ',max);
Writeln('Phan tu co gia tri nho nhat: ',min);
readln;
end.
Var a:array:[1..1000] of integer;
i,n,dl,dc:integer;
Begin
Write('Nhap so luong so n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
If a[i] mod 2 = 0 then dc:=dc+1
Else dl:=dl+1;
End;
Writeln('Co ',dc,' so chan');
write('Co ',dl,' so le');
Readln
End.