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.
#include <bits/stdc++.h>
using namespace std;
long long a[200],n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
sort(a+1,a+n+1);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n;
int main()
{
freopen("bai2.inp","r",stdin);
freopen("bai2.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
cout<<a[i]<<" ";
return 0;
return 0;
}
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n 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(min);
readln;
end.
Câu 2:
uses crt;
var st:string;
begin
clrscr;
write('Nhap xau:'); readln(st);
writeln('Xau ',st,' co ',length(st),' phan tu');
readln;
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=d downto 1 do
write(st[i]);
readln;
end.
const fi='data.txt';
fo='ketqua.txt';
var f1,f2:text;
a:array[1..100]of integer;
n,i,tb,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
inc(n);
read(f1,a[n]);
end;
tb:=0;
dem:=0;
for i:=1 to n do
if a[i] mod 2<>0 then
begin
tb:=tb+a[i];
inc(dem);
end;
writeln(f2,tb/dem:4:2);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10000],n,i;
int main()
{
freopen("bai2.inp","r",stdin);
freopen("bai2.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}