shoodymon

Untitled

Mar 8th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.42 KB | None | 0 0
  1. program hw8;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8.   System.SysUtils;
  9.  
  10. var
  11.     a, b, j, chislo, sum: Integer;
  12.  
  13. begin
  14.    Write('a = ');
  15.    Read(a);
  16.    Write('b = ');
  17.    Read(b);
  18.  
  19.    for chislo := a to b do
  20.    begin
  21.      sum := 0;
  22.      for j := 1 to chislo div 2 do
  23.        if chislo mod j = 0 then
  24.        sum := sum + j;
  25.        if sum = chislo then
  26.         write(chislo,' ')
  27.    end;
  28.  
  29. readln;
  30. readln;
  31. end.
Advertisement
Add Comment
Please, Sign In to add comment