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
Văn Công Sỹ
Xem chi tiết
Văn Công Sỹ
25 tháng 4 2021 lúc 10:28

Làm giúp bài này nhé

 

Bùi Anh Tuấn
25 tháng 4 2021 lúc 19:41

Nguyễn Lê Phước Thịnh
25 tháng 4 2021 lúc 22:19

uses crt;

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

i,n,min,tam,j: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('Gia tri nho nhat la: ',min);

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.

Lê Tâm Anh
Xem chi tiết
gấu béo
7 tháng 5 2023 lúc 19:20

program Le_Nho_Hon_Hoac_Bang_n;

uses crt;

var

       n, i: integer;

begin

       clrscr;

       write('Nhap vao mot so nguyen duong n: ');

       readln(n);

       while n <= 0 do

       begin

              writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');

              readln(n);

       end;

       clrscr;

       writeln('Cac so le nho hon hoac bang ', n, ' la:');

       i := 1;

       while i <= n do

       begin

              if i mod 2 <> 0 then

                     writeln(i);

              i := i + 1;

       end;

       readln;

end.

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.

ádfg
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 12 2021 lúc 23:11

#include <bits/stdc++.h>

using namespace std;

long long a[100],b[100],c[100],n,i,dem1,dem2;

int main()

{

cin>>n;

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

cin>>a[i];

dem1=0;

dem2=0;

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

{

if (a[i]%2==0) 

{

dem1++;

b[dem1]=a[i];

}

else 

{

dem2=0;

c[dem2]=a[i];

}

}

sort(b+1,b+dem1+1);

sort(c+1,c+dem2+1);

for (i=1; i<=dem1; i++)

cout<<b[i]<<" ";

for (i=dem2; i>=1; i--)

cout<<c[i]<<" ";

return 0;

}

trần hoàng
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 21:53

#include <bits/stdc++.h>

using namespace std;

long long i,n,kt,j;

int main()

{

cin>>n;

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

{

kt=0;

for (j=2; j*j<=i; j++)

if (i%j==0) kt=1;

if (kt==0) cout<<i<<" ";

}

return 0;

}

ytkc
Xem chi tiết
Nguyễn Hoàng Duy
17 tháng 6 2023 lúc 10:42

#include <iostream>

using namespace std;

int main() {
    int n;
    cout << "Nhap vao mot so nguyen khong am: ";
    cin >> n;

    int count = 0;
    for (int i = n + 1; i <= n * n; i++) {
        if (i > 0) {
            count++;
        }
    }

    cout << "So luong so duong lon hon " << n << " va nho hon hoac bang " << n * n << " la: " << count << endl;

    return 0;
}

ytkc
15 tháng 6 2023 lúc 21:01

#include <iostream>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    cout <<n*n-n<<endl;
    return 0;
}

 

Kisaragi Saya
Xem chi tiết
Đỗ Tuệ Lâm
17 tháng 2 2022 lúc 7:10

{program bt_1;
uses crt;
Var:S ,n, i, j:longint;
Begin 
  clrsr;
  Write('Nhap n');Readln(n);
    For i:=1 to n do
    Begin
      S:=0;
      For j:=0 to i do
      if i mod j:=0 then S:=S+j;
      if S=2*i then Write (i:5);
    end;
readln;
end.
}

Lưu Nguyễn Hải Nam
6 tháng 12 2023 lúc 18:54

PASSCAL HAY???

 

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.

Anh Thế
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 22:16

#include <bits/stdc++.h>

using namespace std;

int i,n;

int main()

{

cin>>n;

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

if (i%2==1) cout<<i<<" ";

return 0;

}