viết chương trình nhập 1 dãy số .sau đó đếm xem có bau nhiêu số chẵn.
help mình vs free pascal mình cần gấp!!!!
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.
uses crt;
Var i,n,dem:integer;
a: array[1..1000] of integer;
Begin
clrscr;
Write('Nhap do dai cua day: ');readln(n);
dem:=0;
for i:= 1 to n do
Begin
write('So thu ',i,' = ');
readln(a[i]);
if a[i] mod 2 = 0 then inc(dem);
end;
Writeln('Day so co ',dem,' so chan');
readln;
End.
uses crt;
Var i,n,dem:integer;
a: array[1..1000] of integer;
Begin
clrscr;
Write('Nhap do dai cua day: ');readln(n);
dem:=0;
for i:= 1 to n do
Begin
write('So thu ',i,' = ');
readln(a[i]);
if a[i] mod 2 = 0 then inc(dem);
end;
Writeln('Day so co ',dem,' so chan');
readln;
End.
uses crt;
Var i,n,dem:integer;
a: array[1..1000] of integer;
Begin
clrscr;
Write('Nhap do dai cua day: ');readln(n);
dem:=0;
for i:= 1 to n do
Begin
write('So thu ',i,' = ');
readln(a[i]);
if a[i] mod 2 = 0 then inc(dem);
end;
Writeln('Day so co ',dem,' so chan');
readln;
End.
uses crt;
var i,n,dem:longint;a:array[1..1000]of longint;
begin
clrscr;
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;
for i:=1 to n do if(a[i] mod 2=0)then inc(dem);
writeln('co tat ca:',dem,'so chan');
readln;
end.
program im_14424;
uses crt;
var A: array [1..99999] of integer;
i,n,dem : integer;
begin
clrscr;
dem:=0;
write('Nhap vao so phan tu: ',n);
readln(n);
for i:=1 to n do
begin
write('Nhap vao phan tu thu ',i,':');
readln(A[i]);
if (A[i] mod 2 = 0) then dem:=dem+1;
end;
write('So cac so chan la: ',dem);
readln(dem);
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln(dem);
readln;
end.
uses crt;
var n,i,dem,x:integer;
begin
clrscr;
readln(n);
dem:=0;
for i:=1 to n do
begin
readln(x);
if x mod 2=0 then inc(dem);
end;
write(dem);
readln;
end.
Var a:array:[1..1000] of integer;
i,n,t,d:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
if (a[i] mod 2 = 0) and (a[i] mod 3 = 0) then
d:=d+1;
End;
Writeln('Co ',d,' so chia het cho 2 va 3');
For i:=1 to n do
If a[i] < a[i+1] then
begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
end;
write('Day sau khi sap xep la: ');
for i:=1 to n do
Write(a[i]:8);
Readln
End.
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n,t,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
s:=1;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then
begin
inc(dem);
t:=t+a[i];
s:=s*a[i];
end;
if dem=0 then writeln('Khong co so chia het cho 3 trong day')
else begin
writeln('Tong cac so chia het cho 3 la: ',t);
writeln('Tich cac so chia het cho 3 la: ',s);
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
readln;
end.
Var a:array[1..200] of integer;
i,n,dem: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;
dem:=0;
For i:=1 to n do
If a[i]>5 then dem:=dem+1;
Write('So phan tu lon hon 5 la ',dem);
Readln;
End.
Program Tin_hoc;
uses crt;
var n,i,dem:integer;
a:array[1..10000] of integer;
Begin
clrscr;
readln(n);
dem:=0;
for i:= 1 to n do
Begin
readln(a[i]);
if a[i] mod 2 = 0 then inc(dem);
end;
writeln('Day so co ',dem,' so chan');
readln;
end.