Program Pr1; uses crt; var i,n,a:integer; Begin clrscr; readln(n); i:=1; a:=0; while i<=n do begin if (n mod i=0) and (i<>n) then a:=a+i; inc(i); end; if a=n then writeln('YES') else writeln('No'); end.
var n,m,i:integer; begin readln(n); m:=0; for i := 1 to n-1 do if m > n then break else if (n mod i = 0) then m:=m+i; if m=n then writeln('Yes') else writeln('No'); end.
Answers & Comments
Program Pr1;
uses crt;
var i,n,a:integer;
Begin
clrscr;
readln(n);
i:=1; a:=0;
while i<=n do begin
if (n mod i=0) and (i<>n) then a:=a+i;
inc(i);
end;
if a=n then writeln('YES')
else writeln('No');
end.
uses
SysUtils;
var
n,m,i:integer;
begin
readln(n);
m:=0;
for i := 1 to n-1 do
if m > n then break else
if (n mod i = 0) then m:=m+i;
if m=n then writeln('Yes') else
writeln('No');
end.