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.
Bài 1:
uses crt;
var a:array[1..200]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 5=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 5 la: ',t);
readln;
end.
Bài 2:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(st);
readln;
end.
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;
writeln('Chi so cua so hang cuoi cung la: ',n);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i,k,dem,dem1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem);
if a[i] mod k=0 then inc(dem1);
end;
writeln('So phan tu chan la: ',dem);
writeln('So phan tu chia het cho ',k,' la: ',dem1);
readln;
end.
uses crt;
var a:array[1..10]of integer;
i,n,dem:integer;
begin
clrscr;
for i:=1 to 10 do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>0;
end;
writeln('Day so vua nhap la: ');
for i:=1 to 10 do
write(a[i]:4);
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln;
writeln('So luong so chan la: ',dem);
readln;
end.
uses crt;
var a:array[1..200]of integer;
n,i,k,t,t1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
t1:=0;
for i:=1 to n do
if a[i] mod k=0 then t1:=t1+a[i];
writeln('Tong cac phan tu le la: ',t);
writeln('Tong cac phan tu la boi cua ',k,' la: ',t1);
readln;
end.
Program HOC24;
var a: array[1..32000] of integer;
i,n,tg,c,l: integer;
tc,tl: longint;
begin
write('Nhap N: '); readln(n);
c:=0; l:=0; tc:=0; tl:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i];
if a[i] mod 2=0 then
begin
c:=c+1;
tc:=tc+a[i];
end;
if a[i] mod 2=1 then
begin
l:=l+1;
tl:=tl+a[i];
end;
end;
write('Day da sap xep: ');
for i:=1 to n do if a[i] mod 2=1 then write(a[i],' ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
wirteln('Co ',l,' so le');
writeln('Co ',c,' so chan');
writeln('Tong cac so le la: ',tl);
writeln('Tong cac so chan la:', tc);
readln
end.
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;
writeln('Cac so chan la: ');
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(a[i]:4);
t:=t+a[i];
inc(dem);
end;
writeln('Tong cac so chan la: ',t);
writeln('Trong day co ',dem,' so chan');
readln;
end.
Program FNG;
Uses crt;Var A: array[1..1000] of longint; n,i,s,da,sa: longint;Begin Clrscr; Write('Nhap n: '); Readln(n); s:=0; da:=0; sa:=0; For i:=1 to n do Begin Write('A[',i,'] = '); Readln(A[i]); s:=s+A[i]; If A[i]<0 then Begin inc(da); sa:=sa+A[i]; End; End; Writeln('S = ',s); Writeln('Dem am = ',da) Write('Tong am = ',sa); ReadlnEnd.
Nhập mảng xong rồi làm gì nữa bạn?