Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
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.

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.

nguyễn an phát
Xem chi tiết
Bùi Trung Tín
Xem chi tiết
Trầm tiến
Xem chi tiết
Kiều Vũ Linh
16 tháng 5 2023 lúc 21:31

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

i,n,t,d:integer;

Begin

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

For i:=1 to n do

Begin

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

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

d:=d+1;

End;

Writeln('Co ',d,' so chia het cho 2 va 3');

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('Day sau khi sap xep la: ');

for i:=1 to n do

Write(a[i]:8);

Readln

End.

Hoangf Thu
Xem chi tiết
Phan Thu
Xem chi tiết
Nguyễn Thị Hồng Cảnh
Xem chi tiết
nguyenhoanganh
2 tháng 5 2021 lúc 9:52

program (Nhập tên gì ở dây cx đc tùy bạn);;

ues crt;

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

      i,j,n,tg:integer;

begin clrscr;

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

   for i:=1 to n do

     begin

        writeln('Nhap so thu ',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

           tg:=A[i];

           A[i]:=A[j];

           A[j]:=tg;

        end;

   writeln('Day so sap xep theo thu tu tang dan la: ');

   for i:=1 to n do

     write(A[i]:3);

readln;

end.

b)

Luyến
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 3 2021 lúc 17:06

uses crt;

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

i,n,dem:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

dem:=0;

for i:=1 to n do 

  if a[i] mod 3=0 then inc(dem);

writeln(dem);

readln;

end.

khonopro
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 15:01

#include <bits/stdc++.h>

using namespace std;

int A[1000],n,i;

int main()

{

cin>>n;

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

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

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

cout<<A[i]<<" ";

cout<<endl;

for (int i=2; i<=n; i++)

cout<<A[i]-A[i-1]<<endl;

return 0;

}