write a program to check whether a given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]

Answer Posted / venkat

void main()
{
int n,f=1,rem,x,res=0,i;
clrscr();
printf("enter a number");
scanf("%d",&n);
x=n;
for(;n>0;n=n/10)
{
rem=n%10;
f=1;
for(i=1;i<=rem;i++)
f=f*i;
res=res+f;
}
if(res==x)
printf("given number is a strong number");
else
printf("given number is not a strong number");
getch();
}

Is This Answer Correct ?    18 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The file stdio.h, what does it contain?

665


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

559


What is pre-emptive data structure and explain it with example?

3207


how can use subset in c program and give more example

1495


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

1862






How can I open a file so that other programs can update it at the same time?

656


What does c mean in basketball?

561


What is the use of c language in real life?

527


List the difference between a "copy constructor" and a "assignment operator"?

579


Write a program for Overriding.

680


Why void main is used in c?

559


Without Computer networks, Computers will be half the use. Comment.

1869


What is getch?

630


Why is sizeof () an operator and not a function?

578


Explain low-order bytes.

622