declare a integer:=&a; c integer:=0; i integer; begin for i in 1 .. a-1 loop if (mod(a,i)=0) then c:=c+i; end if; end loop; if c=a then dbms_output.put_line('Perfect number'); else dbms_output.put_line('Not Perfect 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