Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program hw10;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils, Math;
- var
- i,temp,digits,Sum:Integer;
- begin
- for i := 10 to 9999 do
- begin
- digits := 0;
- temp := i;
- while temp > 0 do
- begin
- temp := temp div 10;
- Inc(digits);
- end;
- temp := i;
- Sum := 0;
- while temp > 0 do
- begin
- Sum := Sum + Round(Power(temp mod 10,digits));
- temp := temp div 10;
- end;
- if i = Sum then
- writeln (i);
- end;
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment