program Calc;
uses
Math;
var
i, j, s, n, m: Integer;
d: Double;
begin
for i := 1 to 1000 do begin
s := 0;
j := i;
while j > 0 do begin
d := j mod 10;
d := Power (d, 3);
s := s + Trunc (d);
j := j div 10;
end;
if s = i then
WriteLn (s);
ReadLn;
end.
Объяснение:
в ответе 5 номеров:
1
153
370
371
407
program Calc;
uses
Math;
var
i, j, s, n, m: Integer;
d: Double;
begin
for i := 1 to 1000 do begin
s := 0;
j := i;
while j > 0 do begin
d := j mod 10;
d := Power (d, 3);
s := s + Trunc (d);
j := j div 10;
end;
if s = i then
WriteLn (s);
end;
ReadLn;
end.
Объяснение:
в ответе 5 номеров:
1
153
370
371
407