Friday, September 12, 2008

STRONG NUMBER in c programming language


void main()
{
int num,i,f,r,sum=0,temp;
clrscr();
printf("\nEnter a number");
scanf("%d",&num);
temp=num;
while(num)
{
i=1,f=1;
r=num%10;
while(i<=r)
{
f=f*i;
i++;
}
sum=sum+f;
num=num/10;
}
if(sum==temp)
printf("%d is a strong number",temp);
else
printf("%d is not a strong number",temp);
getch();
}

No comments:

Post a Comment

Thanks to given comments.......

My Blog List