Những câu hỏi liên quan
Tran dang khoa
Xem chi tiết
Tran dang khoa
24 tháng 7 2023 lúc 13:58

cứu em với mn còn 30p cuối thôi

Bình luận (0)
HSNK HSG
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 10 2021 lúc 0:01

uses crt;

var a:array[1..50]of int64;

i,n,t,max,min:int64;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

max:=a[1];

min:=a[1];

t:=0;

for i:=1 to n do 

begin

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

if min>a[i] then min:=a[i];

t:=t+a[i];

end;

writeln('Tong la: ',t);

writeln('So lon nhat la: ',max);

write('Vi tri la: ');

for i:=1 to n do

if a[i]=max then write(i:4);

writeln;

writeln('So nho nhat la: ',min);

write('Vi tri la: ');

for i:=1 to n do 

if a[i]=min then write(i:4);

readln;

end.

Bình luận (0)
hoquanghieu
Xem chi tiết
Nguyễn Giang Ank
12 tháng 4 2022 lúc 21:42

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.

Bình luận (1)
Nguyễn Lê Phước Thịnh
13 tháng 4 2022 lúc 18:22

#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;

}

Bình luận (0)
Thắng Lee
Xem chi tiết
Jhon wisk
Xem chi tiết
Kiều Vũ Linh
25 tháng 4 2023 lúc 7:31

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.

Bình luận (0)
hoho209
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 3 2021 lúc 23:30

Bài 1: 

uses crt;

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

i,n,tam,j:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

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;

for i:=1 to n do 

  write(a[i]:4);

readln;

end.

Bình luận (0)
hoho209
19 tháng 3 2021 lúc 0:35

Làm giúp em câu 2 với ạ

Bình luận (0)
Nguyễn Ngọc Diễm My
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 4 2022 lúc 18:53

#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;

}

Bình luận (0)
Panda
Xem chi tiết
29_LÃ XUÂN SƠN
Xem chi tiết