Dinh Thi Hai Ha

Những câu hỏi liên quan
Holmes Sherlock
Xem chi tiết
Holmes Sherlock
Xem chi tiết
Panda
Xem chi tiết
Hiền Phạm
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 1 2022 lúc 15:00

#include <bits/stdc++.h>

using namespace std;

long long a[8],n,i,j;

int main()

{

n=8;

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

for (i=1; i<=n-1; i++)

for (j=i+1; j<=n; j++)

if (a[i]<a[j]) swap(a[i],a[j]);

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

return 0;

}

Bình luận (0)
Nguyen Thien Tram Nhu
Xem chi tiết
Long Phan
Xem chi tiết
ngô thị huỳnh thơ
Xem chi tiết
Trần Thị Huyền Linh
28 tháng 5 2018 lúc 21:02

lần 1:đổi 3 vs 1:1,3,7,9,5

lần 2:đổi:7 vs 5:1,3,5,9,7

lần 3:đổi:7 vs 9:1,3,5,7,9

k cho mk nha bn

chúc bn hc tốt 

Bình luận (0)
Hosimiya Ichigo
28 tháng 5 2018 lúc 21:03

Đổi số 1 lên đầu,số 5 ở thứ 3.

Ta có:1,3,5,7,9

Bình luận (0)
Ngoc Hong
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:29

Câu 1:

Program HOC24;

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

i,n: integer; tbc: real;

begin

write('Nhap so phan tu trong mang: '); readln(n);

for i:=1 to n do

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

tbc:=0;

 

for i:=1 to n do tbc:=tbc+a[i];

tbc:=tbc/n;

write('Trung binh cong la: ',tbc:6:2);

 

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:37

Câu 2:

Program HOC24;

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

i,n,h,tg: integer;

begin

write('Nhap so phan tu trong mang: '); readln(n);

for i:=1 to n do

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

for i:=1 to n do

for j:=i to n do

if a[i]>a[j] then

begin

tg:=a[i];

a[i]:=a[j];

a[j]:=tg;

end;

write('Mang sau khi sap xep la: ');

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

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:38

Câu 3:

Program HOC24;

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

i,n,h,tg: integer;

begin

write('Nhap so phan tu trong mang: '); readln(n);

for i:=1 to n do

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

for i:=1 to n do

for j:=i to n do

if a[i]<a[j] then

begin

tg:=a[i];

a[i]:=a[j];

a[j]:=tg;

end;

write('Mang sau khi sap xep la: ');

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

readln

end.

Bình luận (0)
Huy Phạm
Xem chi tiết
Kiều Vũ Linh
3 tháng 5 2023 lúc 6:12

1)

Var array:[1..1000] of integer;

i,n,t:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

For i:=1 to n do

If a[i] > a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep tang dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Bình luận (0)
Kiều Vũ Linh
3 tháng 5 2023 lúc 6:13

2)

Var array:[1..1000] of integer;

i,n,t:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

For i:=1 to n do

If a[i] < a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep giam dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Bình luận (0)