14
9
Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
2377
1794
uses crt;
var i,n,t,j:longint; a:array[1..1000000]of longint;
begin
clrscr;
write('n=');readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(A[i]);
for j:=1 to i do
if a[j]<a[i] then begin t:=a[i]; a[i]:=a[j]; a[j]:=t; end;
end;
for i:=1 to n do write(a[i]:5); writeln;
for i:=1 to n do write(a[n-i+1]:5); writeln;
readln
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
`* C++:`
`" "`
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
cout << "n = ";
cin >> n;
cout << "Nhap day gom " << n << " so: ";
int dep[n], indi;
for (indi = 0; indi < n; indi++)
cin >> dep[indi];
sort(dep, dep + n);
cout << "Thu tu khong giam: ";
for (indi = 0; indi < n; indi++)
cout << dep[indi] << " ";
cout << "\nThu tu khong tang: ";
for (indi = n - 1; indi > -1; indi--)
cout << dep[indi] << " ";
return 0;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin