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
Trí Nguyễn
Xem chi tiết
Phía sau một cô gái
7 tháng 7 2023 lúc 20:19

program bai_toan;

var

      N, i, sum: integer;

begin

      write('Nhap so N: ');

      readln(N);

      write('Cac uoc cua ', N, ' khong ke ', N, ' la: ');

      for i := 1 to N - 1 do

            if N mod i = 0 then

                  write(i, ' ');

      writeln;

      sum := 0;

      for i := 1 to N - 1 do

      begin

            if N mod i = 0 then sum := sum + i;

      end;

      if sum = N then writeln(N, ' la so hoan hao')

      else writeln(N, ' khong phai la so hoan hao');

      writeln;

      writeln('Tat ca so hoan hao trong pham vi 1 -> ', N, ' la:');

      for i := 1 to N do

      begin

            sum := 0;

            for j := 1 to i - 1 do

            begin

                  if i mod j = 0 then sum := sum + j;

            end;

            if sum = i then writeln(i);

      end;

      readln;

end.

KenShi
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 12 2021 lúc 0:39

Bài 2: 

#include <bits/stdc++.h>

using namespace std;

long long x,y;

int main()

{

cin >>x>>y;

cout<<x<<" "<<y;

swap(x,y);

cout<<x<<" "<<y;

return 0;

}

Quỳnh
Xem chi tiết
Minh Lệ
29 tháng 4 2021 lúc 14:33

Program HOC24;

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

i,n,d: integer;

begin

write('Nhap N: ');

for i:=1 to n do

begin

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

end;

write('Day vua nhap la: '); 

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

d:=0;

for i:=1 to n do if a[i]>0 then d:=d+1;

write('Co ',d,' so duong');

readln

end.

Nguyễn Thanh Anh
Xem chi tiết
Quỳnh Hoa
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 10 2021 lúc 23:22

#include <bits/stdc++.h>

using namespace std;

long n,i,dem,t;

int main()

{

cin>>n;

dem=0;

t=0;

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

if (n%i==0) 

{

dem++;

t=t+i;

}

cout<<dem<<" "<<t;

return 0;

}

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.

Ngọc hà
Xem chi tiết
Nhung
23 tháng 5 2022 lúc 22:38

program trungbinh;

uses crt;

var n,i: integer;

      s:real;

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

begin

clrscr;

write('Nhap do dai day: '); readln(n);

writeln('Nhap gia tri cua day: ');

S:=0;

for i:=1 to n do

begin

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

readln(A[i]);

S:=S+A[i];

end;

S:=S/n;

write('Trung binh cua cac so cua day do la: ',S);

readln;

end.

Phong
Xem chi tiết
Phía sau một cô gái
23 tháng 3 2023 lúc 19:38

program Tim_Uoc;

uses crt;

var

     n, i: integer;

begin

     clrscr;

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

     readln(n);

     writeln('Cac uoc cua so ', n, ' la: ');

     for i:=1 to n do

     begin

          if n mod i = 0 then

               writeln(i);

     end;

     readln;

end.

Nhung Hoàng
Xem chi tiết
Minh Lệ
24 tháng 7 2021 lúc 9:52

Program HOC24;

var i,n: integer;

function nt(x: longint): boolean;

var j: longint;

begin

nt:=true;

if (x=2) or (x=3) then exit;

nt:=false;

if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;

j:=5;

while j<=trunc(sqrt(x)) do

begin

if (x mod j=0) or (x mod (j+2)=0) then exit;

j:=j+6;

end;

nt:=true;

end;

begin

write('Nhap N: '); readln(n);

write('Cac uoc nguyen to cua ',n,' la: ');

for i:=1 to n do if (n mod i=0) and nt(i) then write(i,' ');

readln

end.

Chira Nguyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 2 2021 lúc 20:20

for i:=1 to n do 

  if n mod i=0 then write(i:4);

Nguyễn Lê Phước Thịnh
23 tháng 2 2021 lúc 20:21

Chương trình đầy đủ:

uses crt;

var n,i:integer;

begin

clrscr;

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

for i:=1 to n do 

  if n mod i=0 then write(i:4);

readln;

end.