Răspuns:
program Suma_cub_cif;
var n, s, c, m, nr, i:integer;
begin
readln(n); nr:=0;
for i:=0 to n-1 do
begin
m:=i; s:=0;
while m>0 do
begin
c:=m mod 10;
s:=s+c*c*c;
m:=m div 10;
end;
if s=i then
begin inc(nr); write(i,' '); end;
end;
if nr=0 then writeln('nu exista');
end.
Explicație: