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.

10 tháng 10 2022

uses crt;

var n,i,t,j,t1:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do 

  begin 

t1:=0;

for j:=2 to n div 2 do

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

if t1=i then t:=t+i;

end;

writeln(t);

readln;

end.

uses crt;

var n,i,t,j:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

  begin

t:=0;

for j:=1 to i div 2 do 

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

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

end;

readln;

end.

28 tháng 3 2023

for ... do

program Tinh_S;

uses crt;

var i,n:byte;

     S:longint;

begin

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

       S:=0;

       for i:=1 to n do 

           if i mod 2=1 then S:=S+i;

       writeln('Tong cac so le nho hon hoac bang n la, S=',S)

       readln

end.

 

 

 

28 tháng 3 2023

Tính tổng số lẻ bạn nhé

12 tháng 3 2023

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

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

write('Ket qua: ',t);

readln

end.

22 tháng 7 2023

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.

1 tháng 2 2021

Cho biến i chạy từ 1 đến n. Xét i. Nếu nó là số hoàn chỉnh thì in ra.

Program Tim_uoc_2;

uses crt;

Var S, n, i,j: longint;

Begin

clrscr;

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

For i:=1 to n do

Begin

S:=0;

For j:=1 to i do if i mod j = 0 then S:=S+j;

if S = 2*i then write(i:6,',');

end;

readln

end.

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 do 

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

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

end;

readln;

end.

5 tháng 5 2019

đây nè bạn ơi

Bài 5. Từ bài toán đến chương trình

5 tháng 5 2019

à quên bạn sử lại chỗ ghi "tich" thành "tong" nhé

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.