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.
1:
uses crt;
var a:array[1..30]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 3=0 then inc(dem);
writeln(dem);
readln;
end.
2:
uses crt;
var a:array[1..30]of integer;
i,n,x,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap x='); readln(x);
dem:=0;
for i:=1 to n do
if a[i]=x then inc(dem);
writeln('So phan tu bang ',x,' la: ',dem);
for i:=1 to n do
if a[i]=x then write(i:4);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
begin
readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
readln;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 10=0 then
begin
write(a[i]:4);
inc(dem);
t:=t+a[i];
end;
writeln;
writeln(dem);
writeln(t);
readln;
end.
Program HOC24;
var d,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;
write('Cac phan tu cua mang vua nhap la: ');
for i:=1 to n do write(a[i],' ');
writeln;
d:=0;
for i:=1 to n do if 10 mod a[i]=0 then d:=d+1;
writeln('Co ',d,' phan tu co gia tri la uoc cua 10');
write('Cac phan tu o vi tri chan la: ');
for i:=1 to n do if i mod 2=0 then write(a[i],' ');
writeln;
write('Cac phan tu o vi tri le la: ');
for i:=1 to n do if i mod 2=1 then write(a[i],' ');
readln
end.
Var a:array[1..30] of integer;
i,n,d,max:integer;
Begin
Write('Nhap so luong phan tu cua mang ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
End;
max:=a[1];
For i:=2 to n do
Begin
If a[i] > max then
Begin
max:=a[i];
d:=i;
End;
End;
Write('Phan tu lon nhat la ',max,' o vi tri ',d);
Readln;
End.
Var a:array[1..30] of integer;
i,n,d,max:integer;
Begin
Write('Nhap so luong phan tu cua mang ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
End;
max:=a[1];
For i:=2 to n do
Begin
If a[i] > max then
Begin
max:=a[i];
d:=i;
End;
End;
Write('Phan tu lon nhat la ',max,' o vi tri ',d);
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 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.
Bài 1
Var a:array:[1..99] of integer;
i,n:integer;
s:longint;
Begin
Repeat
Write('n = ');readln(n);
Until (n > 0) and (n < 100);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
if a[i] mod 2 = 0 then s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so chan la ',s);
Readln
End.
Bài 2
Var a:array:[1..99] of integer;
i,n:integer;
s:longint;
Begin
Repeat
Write('n = ');readln(n);
Until (n > 0) and (n < 100);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
if a[i] mod 2 <> 0 then s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so le la ',s);
Readln
End.
uses crt;
var a:array[1..100]of integer;
i,n,k,h,dem,t,dem1,dem2,t1,t2:integer;
begin
clrscr;
for i:=1 to 100 do
begin
write('A[',i,']='); readln(a[i]);
end;
n:=100;
write('Nhap k='); readln(k);
for i:=1 to n do
if a[i]=k then write(i:4);
writeln;
write('Nhap h='); readln(h);
dem:=0;
for i:=1 to n do
if a[i]=h then inc(dem);
writeln(h,' xuat hien ',dem,' lan trong mang');
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac phan tu cua day la: ',t);
dem1:=0;
t1:=0;
dem2:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then
begin
inc(dem1);
t1:=t1+a[i];
end;
if a[i]<0 then
begin
inc(dem2);
t2:=t2+a[i];
end;
end;
writeln('Co ',dem1,' so duong');
writeln('Tong cac so duong la: ',t1);
writeln('Co ',dem2,' so am');
writeln('Tong cac so am la: ',t2);
readln;
end.