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..10000] of longint;
begin
write('N='); readln(n);
for i:=1 to n do readln(A[i]);
max:=A[1]; min := A[1];
for i:=1 to n do
begin
if A[i]>max then max:=A[i];
if A[i]<min then min:=A[i];
end;
for i:=1 to n 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;
write(min,' ',max);
for i:=1 to n do writeln(A[i]);
readln
end.
{ Bo sung phan khai bao:
Them phan nay vao khai bao
i,j,n,max,min:longint;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
sort(a+1,a+n+1);
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}
Var a:array[1..1000] of integer;
i,m,tam:integer;
Begin
Write('m = ');readln(m);
For i:=1 to m do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to m do
If a[i] < a[i+1] then
Begin
tam:=a[i];
a[i]:=a[i+1];
a[i+1]:=tam;
End;
Write('Mang sau khi sap xep: ');
For i:=1 to m do
Write(a[i]:8);
Readln;
End.
uses crt;
var a:array[1..100]of integer;
i,n,min,tam,j:integer;
begin
clrscr;
n:=100;
for i:=1 to 100 do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln('Gia tri nho nhat la: ',min);
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;
writeln('Day so tang dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.
uses crt;
var a,b,c:array[1..100]of longint;
n,m,i,j,dem,tam:integer;
begin
clrscr;
{------------nhap-mang-A----------------}
write('chieu dai mang A='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{------------nhap-mang-B----------------}
write('chieu dai mang B='); readln(m);
for j:=1 to m do
begin
write('b[',j,']='); readln(b[j]);
end;
{-----------------xuat-day-A--------------------}
writeln('day A=');
for i:=1 to n do
write(a[i]:4);
{---------------xuat-day-B--------------------}
writeln;
writeln('day B=');
for j:=1 to m do
write(b[j]:4);
writeln;
{------------sap-xep-mang-A------------------}
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;
writeln('day A sau khi sap xep la: ');
for i:=1 to n do write(a[i]:4);
{-----------sap-xep-mang-B------------------}
writeln;
for i:=1 to m-1 do
for j:=i+1 to m do
if b[i]>b[j] then
begin
tam:=b[i];
b[i]:=b[j];
b[j]:=tam;
end;
writeln('day B sau khi sap xep la: ');
for j:=1 to m do write(b[j]:4);
{--------------cho-cac-phan-tu-cua-A-va-B-vao-array-C------------------}
writeln;
writeln('day C=');
dem:=0;
for i:=1 to n do
begin
inc(dem);
c[dem]:=a[i];
end;
for j:=1 to m do
begin
inc(dem);
c[dem]:=b[j];
end;
for i:=1 to dem do write(c[i]:4);
{----------------sap-xep-mang-C-----------------}
for i:=1 to dem-1 do
for j:=i+1 to dem do
if c[i]>c[j] then
begin
tam:=c[i];
c[i]:=c[j];
c[j]:=tam;
end;
writeln;
writeln('day C sau khi sap xep la: ');
for i:=1 to dem do
write(c[i]:4);
readln;
end.