uses crt; var a:array[1..10000] of longint; t,n,i,j:longint; begin clrscr; write(‘Ban muon nhap may chu so: ‘);readln(n); for i:=1 to n do begin write(‘So thu ‘,i,’=’);readln(a[i]); end; for i:=1 to n-1 do for j:=i+1 to n do if a[i]<a[j] then begin t:=a[i]; a[i]:=a[j]; a[j]:=t; end; writeln(‘6 so lon nhat vua nhap la: ‘); for i:=1 to 6 do write(a[i],’ ‘); readln; end.
program ct;
uses crt;
var a:array[1..6] of integer;
max,i:integer;
begin
for i:=1 to 6 do begin
write(‘nhap a[‘,i,’] : ‘);
readln(a[i]);
end;
max:=a[1];
for i:=1 to 6 do if a[i]>max then max:=a[i];
write(‘max la:’,max);
readln;
end.
uses crt;
var a:array[1..10000] of longint;
t,n,i,j:longint;
begin
clrscr;
write(‘Ban muon nhap may chu so: ‘);readln(n);
for i:=1 to n do
begin
write(‘So thu ‘,i,’=’);readln(a[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
writeln(‘6 so lon nhat vua nhap la: ‘);
for i:=1 to 6 do write(a[i],’ ‘);
readln;
end.