declare
a integer:=&a;
c integer:=a;
d integer;
sume integer:=0;
begin
while (a>0)
loop
d:=mod(a,10);
sume:=sume+d*d*d;
a:=trunc(a/10);
end loop;
if (sume=c)
then
dbms_output.put_line('Amstrong number');
else
dbms_output.put_line('Not Amstrong number');
end if;
end;
/
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter