K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

D
datcoder
CTVVIP
19 tháng 2

Program HOC24;

var i,n,d,max,m: integer;

begin

write('Nhap so nguyen duong N: '); readln(n);

d:=1;

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

for i:=1 to n/2 do 

    if n mod i=0 then  

    begin

        write(i,' ');

        d:=d+1;

     end;

writeln;

writeln('b) So uoc cua so nguyen duong ',n,' la: ',d);

max:=0; d:=0;

while (n>0) do

begin

     for i:=1 to n/2 do if n mod 2=0 then d=d+1;

     if d>=max then

        begin

             max=d;

             m=n;

        end;

write('So M nho nhat la: ',m);

readln

end.

19 tháng 10 2021

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

}

28 tháng 8 2021

uses crt;

var n,i,o,d:integer;

function ktnt(n:integer): integer;

var i,d:integer;

begin

d:=0;

for i:=1 to sqrt(n) do

if (n mod i=0) then d:=d+1;

if d=2 then ktnt=0

else ktnt=1;

end;

begin

readln(n);

writeln(' so nguyen to be hon hoac bang n la'); {a}

for i:=1 to n do

if ktnt(i)=0 then writeln(i);

writeln('so nguyen to nho nhat khong be hon n');

o:=n;

while o>0 do

begin

if ktnt(o)=0 then

begin

write(o);

break;

end;

o:=o+1;

end;

writeln('cặp số nguyên tố là hai số nguyên lẻ liên tiếp nhỏ hơn hoặc bằng n');

o:=0;

o:=1;

d:=0;

for i:=o+2 to n do

begin

if ktnt(i)=0 then

begin

d:=d+1;

write(i,' ');

if d<2 then continue;

end;

d:=0;

writeln;

end;

readln;

end.

28 tháng 8 2021

Mình nói thật nhé là ko có 2 số lẽ liên tiếp nhé

vd n+2 với n là 1

thì số lẻ tiếp theo của nó là (n+2)+2 tức n+4 đấy còn liên tiếp (n+2)+1 là ko bao giờ xãy ra

 

#include <iostream>
using namespace std;
int main()
{
    int t,m,n,ucln;
    cout<<"Nhap n="; cin>>n;
    cout<<"Nhap m="; cin>>m;
    t=m%n;
    while (t!=0)
    {
        t=n%m;
        n=m;
        m=t;
    }
    ucln=n;
    cout<<ucln;
    return 0;
}

 

7 tháng 7 2023

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.

6 tháng 10 2021

Ai giải giúp mik đi ạ đag hok thj bị cô gọi lên bảng ko bt lm như thek nào mn giúp mik vs ạ 😭😭😭😭

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,i;

cin>>n;

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

if (n%i==0) cout<<i<<" ";

return 0;

}

10 tháng 12 2021

2:

#include <bits/stdc++.h>

using namespace std;

long long n,i;

int main()

{

cin>>n;

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

if (n%i==0) cout<<i<<" ";

return 0;

}

15 tháng 2 2017

Program Tim_uoc;

uses crt;

var i,n:integer;

begin

clrscr;

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

For i:=1 to n do if n mod i = 0 then write ( i:3 , ' , ' );

readln

end.

25 tháng 4 2021

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

 

25 tháng 4 2021