Những câu hỏi liên quan
TKT VN
Xem chi tiết
nguyễn an phát
1 tháng 9 2021 lúc 11:21

program bai_1;
uses crt;
var i,n,j,d,dem:word;
begin
  clrscr;
  repeat
    write('nhap n:');readln(n);
    if (n<=0)or(n>=10000)then writeln('so ban nhap khong hop le, ban hay nhap lai:');
  until (n>0)and(n<10000);
  writeln('cac uoc so la so tu nhien cua ',n,' la:');
  for i:=1 to n do
  if n mod i=0 then write(i,'    ');
  writeln;
  dem:=0;
  for i:=2 to n do
  begin
    d:=0;
    for j:=2 to i div 2 do
    if i mod j=0 then inc(d);
    if (d=0)and(n mod i=0)then inc(dem);
  end;
  if dem>0 then writeln('cac uoc so la so nguyen to cua ',n,' la:');
  begin
    d:=0;
    for j:=2 to i div 2 do
    if i mod j=0 then inc(d);
    if (d=0)and(n mod i=0)then write(i,'    ');
  end;
  if dem=0 then write(0);
  readln;
end.

 

Bình luận (0)
Do Ngoc Thao My
Xem chi tiết
Nguyenquochuy
Xem chi tiết
Kiều Vũ Linh
9 tháng 3 2023 lúc 7:37

var i,n,s,du,dem:integer;

Begin

While n<=0 do

Begin

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

End;

For i:=1 to n do

If n mod i = 0 then

Begin

Write(i:7);

du:=du+1;

s:=s+i;

End;

Writeln('So uoc cua ',n,' la ',du);

Writeln('Tong cac uoc cua ',n,' la ',s);

For i:=1 to s do

If s mod i = 0 then dem:=dem+1;

If dem=2 then write(s,' la so nguyen to')

Else write(s,' khong la so nguyen to');

Readln;

End.

Bình luận (1)
35.Yến Oanh 8/4
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 3 2022 lúc 20:22

#include <bits/stdc++.h>

using namespace std;

long long i,n,dem;

int main()

{

cin>>n;

dem=0;

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

if (n%i==0)

{

cout<<i<<" ";

dem++;

}

cout<<endl;

cout<<dem;

return 0;

}

Bình luận (0)
Hiền Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 4 2021 lúc 19:46

a)

uses crt;

var n,i,t,j:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

t:=0;

for j:=1 to i-1 do 

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

if t=i then write(i:4);

end;

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
26 tháng 4 2021 lúc 19:47

b)

uses crt;

var gt:real;

i,n:integer;

begin

clrscr;

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

gt:=1;

for i:=1 to n do 

 gt:=gt*i;

writeln(gt:0:0);

readln;

end.

Bình luận (0)
Kamato Heiji
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 3 2021 lúc 21:34

1:

uses crt;

var i,j,t,kt:integer;

begin

clrscr;

t:=0;

for i:=1 to 100 do 

  if i>1 then 

begin

kt:=0;

for j:=2 to i-1 do 

  if i mod j=0 then kt:=1;

if kt=0 then t:=t+i;

end;

writeln(t);

readln;

end.

Bình luận (4)
Nguyễn Lê Phước Thịnh
16 tháng 3 2021 lúc 21:35

Câu 2: 

*Viết chương trình:

uses crt;

var n,p,t:integer;

begin

clrscr;

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

t:=0;

for p:=2 to n-1 do 

  if n mod p=0 then t:=t+p;

writeln('Tong cac uoc that su cua ',n,' la: ',t);

readln;

end.

Bình luận (0)
Yoriichi_Tsugikuni ( ɻɛɑ...
11 tháng 6 2021 lúc 14:57

Dễ mà bạn tự làm đi

Bình luận (0)
 Khách vãng lai đã xóa
Hoangg Anhh
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 4 2021 lúc 20:40

uses crt;

var n,i,t:integer;

begin

clrscr;

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

t:=0;

for i:=1 to n do

  if n mod i=0 then

begin

write(i:4);

t:=t+i;

end;

writeln;

writeln('Tong cac uoc cua ',n,' la: ',t);

readln;

end.

Bình luận (0)
Đức Thắng
Xem chi tiết
Phía sau một cô gái
22 tháng 7 2023 lúc 19:56

program so_hoan_hao;

var

       n, tong_uoc, i: integer;

begin

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

       readln(n);

       tong_uoc := 0;

       for i := 1 to n-1 do

       begin

              if n mod i = 0 then

                     tong_uoc := tong_uoc + i;

       end;

       if tong_uoc = n then

              writeln('YES')

       else

              writeln('NO');

end.

Bình luận (0)
Trần Thị Mai Ngọc
Xem chi tiết
nguyễn an phát
18 tháng 4 2021 lúc 20:48

program tim_uoc;

uses crt;

var i,n,tong:integer;

begin

clrscr;

write('nhap so n:');readln(n);

i:=1;tong:=0;

writeln('cac uoc cua ',n,' la:');

while i<=n do

if n mod i=0 then

begin

write(i:3);

inc(i);

end;

writeln;

i:=1;writeln('cac uoc chan:');

while i<=n do

begin

if n mod i=0 then 

begin

if i mod 2=0 then write(i:3);

tong:=tong+i;

end;

end;

writeln;

write('tong cac uoc chan:',tong);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
19 tháng 4 2021 lúc 19:17

uses crt;

var n,i,t:integer;

begin

clrscr;

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

i:=1;

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

while i<=n do

  begin

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

i:=i+1;

end;

writeln;

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

t:=0;

i:=1;

while i<=n do 

  begin

if (n mod i=0) then

begin

t:=t+i;

write(i:4);

end;

inc(i);

end;

writeln('Tong cac uoc chan cua ',n,' la: ',t);

readln;

end.

Bình luận (0)