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
Giáo viên
22 tháng 12 2023

#include <bits/stdc++.h>

using namespace std;

int main(){

     int n;

     cin >> n;

     long t;

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

     if (n%i==0) t=t+i;

     cout << t;

     return 0;

}

1:

uses crt;

var t,x,i,n:integer;

begin

clrscr;

t:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

t:=t+x;

end;

write(t);

readln;

end.

2: 

uses crt;

var dem,x,i,n:integer;

begin

clrscr;

dem:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

if x mod 2=0 then inc(dem);

end;

write(dem);

readln;

end.

4 tháng 4 2023

3

program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do

if  i mod 2 = 1 then
write (i,' ');
readln;
end.

c1: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

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

cout<<s;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) if (i%2==0) s=s*i;

cout<<s;

return 0;

}

14 tháng 3 2023

15 tháng 3 2023

program TongUoc;

uses crt;

var
  N, i, Tong: integer;

begin
  clrscr;
  Tong := 0;
  write('Nhap so tu nhien N: ');
  readln(N);

  // Tinh tong cac uoc cua N
  for i := 1 to N do
  begin
    if N mod i = 0 then
    begin
      Tong := Tong + i;
    end;
  end;

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

  readln;
end.

18 tháng 4 2021

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.

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.

4 tháng 5 2022

Tham khảo:

program tim_uoc;
uses crt;
var n,i:integer;
begin
clrscr;
write('Nhap n: ');readln(n);
if (n<0) then 
begin
writeln('So nhap vao khong thoa man.');
write('Nhap lai n: ');readln(n);
end;
writeln('Cac uoc so cua ',n,' tu 1 den ',n,' la: ');
for i:=1 to n do
if ( (n mod i) = 0 ) then write(i,'  ');
readln;
end.

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

}

9 tháng 3 2023

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.

9 tháng 3 2023

Cám ơn nhiều

10 tháng 9 2021

Program HOC24;

var n,i: integer;

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

t: longint;

begin

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

write('Nhap so thu ',i,': '); readln(a[i]);

t:=0;

for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];

write('Tong cac so chan la: ',t);

readln

end.

11 tháng 9 2021

Viết chương trình nhập số nguyên n và n số nguyên từ bàn phím?In ra màn hình tổng các số chia hết cho 3 và 5

 
1 tháng 9 2021

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.