K
Khách

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 n,i,a[5];

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;

}

2 tháng 3 2022

bucminh

2 tháng 3 2022

lỗi rồi bn, mà giúp j vậy ak

#include <bits/stdc++.h>

using namespace std;

long long a[150],i,n;

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[1000],i,n,dem;

int main()

{

cin>>n;

for(i=1; i<=n; i++) cin>>a[i];

dem=0;

for (i=1; i<=n; i++) if (a[i]%10==0) dem++;

cout<<"So luong so chia het cho 2 va 5 la: "<<dem<<endl;

sort(a+1,a+n+1);

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

Bài 1: 

uses crt;

var a:array[1..100]of integer;

i,n,kt,max,x,j,tam:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

writeln('Mang ban vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

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 tang dan la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

write('Nhap x='); readln(x);

max:=0;

kt:=0;

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]<=x) then 

   begin

  if max<a[i] then max:=a[i];

kt:=1;

end;

if kt=0 then writeln('Trong day khong co so le')

else writeln('So chan lon nhat khong vuot qua ',x,' la: ',max);

readln;

end.

13 tháng 3 2021

Program HOC24;

var a: array[1..15] of integer;

tg,i,n,j: integer;

begin

n:=15;

for i:=1 to n do

begin

write('a[',i,']='); readln(a[i]);

end;

for i:=1 to 7 do

for j:=i+1 to 8 do

if a[i]>a[j] then 

begin

tg:=a[i];

a[i]:=a[j];

a[j]:=tg;

end;

for i:=9 to 14 do

for j:=i+1 to 15 do

if a[i]<a[j] then 

begin

tg:=a[i];

a[i]:=a[j];

a[j]:=tg;

end;

for i:=1 to n do write(a[i],' ');

readln

end.

#include <bits/stdc++.h>

using namespace std;

long long a[100],i,n,t;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

sort(a+1,a+n+1);

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

t=0;

for (i=1; i<=n; i++) t+=a[i];

cout<<t;

return 0;

}

7 tháng 10 2020

làm bằng phần mềm pascal nhé

12 tháng 4 2022

uses crt;

var a:array[1..100]of integer;

i,n,dem,t,tb:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

dem:=0;

t:=0;

for i:=1 to n do 

  if a[i]>0 then

begin

dem:=dem+1;

t:=t+a[i];

end;

writeln('So luong phan tu duong la: ',dem);

writeln('Tong cac phan tu duong la: ',t);

writeln('Trung binh cac phan tu duong la: ',t/dem:4:2);

readln;

end.

12 tháng 4 2022

đúng không đây ạ