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.
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
readln;
end.
program TinhTongPhanTuMang;
var
i, tong: integer;
m: array[1..50] of integer;
begin
for i := 1 to 50 do
begin
writeln('Nhap ptu thu ', i, ': ');
readln(m[i]);
end;
tong := 0;
for i := 1 to 50 do
begin
tong := tong + m[i];
end;
writeln('Tong cac ptu trong mang la: ', tong);
writeln('Cac ptu trong mang la:');
for i := 1 to 50 do
begin
writeln(m[i]);
end;
end.
1:
uses crt;
const fi='ketqua.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(f1,st);
close(f1);
end.
2:
uses crt;
var a,b,c,d:integer;
{----------chuong-trinh-con-----------------------}
function min(x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
{---------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
write('d='); readln(d);
writeln(min(a,min(b,min(c,d))));
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t1,t2,tam,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
randomize;
for i:=1 to n do
begin
a[i]:=random(205);
end;
write('Day so vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then t1:=t1+a[i]
else t2:=t2+a[i];
end;
writeln('Tong cac so chan la: ',t1);
writeln('Tong cac so le la: ',t2);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
Câu 1:
var a:array[1..100]of integer;
Câu 2:
uses crt;
var a:array[1..10]of integer;
i:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 10 do
write(a[i]:4);
readln;
end.
Câu 3:
uses crt;
var a:array[1..15]of integer;
i,n,t:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=15);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]<=100;
end;
writeln('Mang da nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln('Tong cac phan tu chia het cho 3 la: ',t);
writeln('Cac so chan o vi tri le trong day la: ');
for i:=1 to n do
if (a[i] mod 2=0) and (i mod 2=1) then write(a[i]:4);
readln;
end.
Chọn C