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;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
Write('Cac phan tu vua nhap la ');
For i:=1 to n do
Write(a[i]:8);
Writeln;
Write('Tong cua chung la ',s);
Readln
End.
uses crt;
var a:array[1..100]of integer;
i,n,max,dem: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
write(a[i]:4);
writeln;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('So lon nhat la: ',max);
write('Vi tri cua so lon nhat la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
writeln;
dem:=0;
for i:=1 to n do
if max=a[i] then inc(dem);
writeln('So luong phan tu lon nhat trong day la: ',dem);
readln;
end.
uses crt;
var a:array[1..100000000] of int64;
n,i,d,max:longint;
begin
clrscr;
repeat
write('Nhap so luong phan tu: '); readln(n);
if (n<=0) and (n>688886) then writeln('NHAP LAI!');
until (n>0) and (n<=688886);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Day so vua nhap: ');
for i:=1 to n do write(a[i],' ');
max:=a[1];
for i:=1 to n do if a[i]>max then max:=a[i];
writeln;
writeln('So lon nhat: ',max);
write('Vi tri cua cac so lon nhat: ');
for i:=1 to n do if a[i]=max then begin write(i,' '); inc(d) end;
writeln;
writeln('So luong so lon nhat: ',d);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,tb:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
writeln(tb/n:4:2);
readln;
end.
Program HOC24;
var d,i,n: integer;
t: real;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
d:=0; t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
d:=d+1;
t:=t+a[i];
end;
t:=t/d;
writeln('Co ',d,' so chan trong mang');
writeln('Trung binh cong cac phan tu chan la: ',t:2:5);
write('Cac phan tu trong day theo chieu doc: ');
for i:=1 to n do writeln(a[i]);
readln
end.
Var a:array[1..200] of real;
i,n,dem:integer;
s,tbc:real;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
s:=0;
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
tbc:=s/n;
Write('Trung binh cong la ',tbc:10:2);
Readln;
End.
Câu 1:
Program HOC24;
var a: array[1..1000] of integer;
i,n: integer; tbc: real;
begin
write('Nhap so phan tu trong mang: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' : '); readln(a[i]);
end;
tbc:=0;
for i:=1 to n do tbc:=tbc+a[i];
tbc:=tbc/n;
write('Trung binh cong la: ',tbc:6:2);
readln
end.
Câu 2:
Program HOC24;
var a: array[1..1000] of integer;
i,n,h,tg: integer;
begin
write('Nhap so phan tu trong mang: '); 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
for j:=i to n do
if a[i]>a[j] then
begin
tg:=a[i];
a[i]:=a[j];
a[j]:=tg;
end;
write('Mang sau khi sap xep la: ');
for i:=1 to n do write(a[i].' ');
readln
end.