Ask a Question

write a program to check given number is perfect number or not. (c programming)

on 2014-08-18 16:15:39   by Animesh   on BCA  1 answers

soumyadip

on 2014-08-18 09:30:00  

#include #include void main() { int num,s,d; printf("enter a number"); scanf("%d",&n); num=n; while(num>0) { s=n%10; d=s*s*s; n=n/10; } if(num==d) { printf("the no is perfect no"); } else { printf("it is not a perfect no"); } }//end of loop } //end of main