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.
Câu 1:
uses crt;
var a:array[1..5]of integer;
max,i:integer;
begin
clrscr;
for i:=1 to 5 do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to 5 do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
Câu 2:
uses crt;
var a:array[1..6]of integer;
min,i:integer;
begin
clrscr;
for i:=1 to 6 do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to 6 do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Var a:array[1..100] of longint;
tb:real;
i,n:integer;
s:longint;
begin
write('Nhap vao so luong so nguyen '); readln(n);
s:=0;
for i:=1 to n do
begin
write('Nhap vao so thu ',i,' = ');readln(a[i]);
s:=s+a[i];
end;
tb:=s/n;
writeln('Gia tri trung binh cua mang do la ',tb:10:2);
writeln('Cac phan tu lon hon gia tri trung binh la');
for i:=1 to n do
begin
if a[i] > tb then write(a[i]:10);
end;
readln;
end.
Var a:array[1..100] of integer;
i,n:integer;
s:longint;
tbc:real;
Begin
Repeat
Write('n = ');readln(n);
Until (n>0) and (n<=100);
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.
Bài 23
var a:array[1..1000] of integer;
i,n:integer;
s,tbc:real;
begin
write('n = ');readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
s:=s+a[i];
end;
tbc:=s/n;
writeln('Gia tri trung binh la ',tbc:10:2);
write('Cac so lon hon gia tri trung binh la: ');
for i:=1 to n do
if a[i] > tbc then write(a[i]:8);
readln
end.
var a:array[1..1000] of integer;
i,n,max:integer;
begin
write('n = ');readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
end;
max:=a[1];
for i:=2 to n do
if a[i] > max then max:=a[i];
for i:=1 to n do
begin
if max=a[i] then write(max,' o vi tri thu ',i);
break;
readln
end.
Uses crt;
Var a:array[1..6] of integer;
i,min:integer;
Begin
Clrscr;
For i:=1 to 6 do
Begin
Write('a[',i,']='); readln(a[i]);
end;
Min:=a[1];
For i:=1 to 6 do
If min<a[i] then min:=a[i];
Writeln(min);
Readln;
End.
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
tb:real;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do t:=t+a[i];
writeln(t/n:4:2);
tb:=t/n;
for i:=1 to n do
if a[i]<tb then write(a[i]:4);
readln;
end.
var a: array[1..100] of integer;
i,n:integer;
begin
writeln('nhap n: '); readln(n);
for i:=1 to n do
begin
readln(a[i]);
end;
for i:=1 to n do
begin
if a[i]=1 then write(1)
else
write('1','/',a[i],' ');
writeln;
end;
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;
for i:=n downto 1 do
write(a[i]:4);
readln;
end.