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 / valli

int fact(int f)
{
if(f==1||f==0)
return 1;
else
return(f*fact(f-1));
}
main()
{
int n,i,j,s=0;
printf("enter the number");
scanf("%d",&n);
i=n;
while(n!=0)
{
j=n%10;
s=s+fact(j);
n=n/10;
}
if(i==s)
printf("strong number");
else
printf("not a strong number");
}

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are bit fields? What is the use of bit fields in a structure declaration?

1500


Explain what is the difference between functions abs() and fabs()?

622


how can f be used for both float and double arguments in printf? Are not they different types?

610


Explain high-order bytes.

677


Can you please explain the difference between malloc() and calloc() function?

622






What does double pointer mean in c?

584


What is variable in c example?

595


How can I rethow can I return a sequence of random numbers which dont repeat at all?

707


Describe wild pointers in c?

641


Do you know pointer in c?

594


What are keywords c?

603


What is array within structure?

588


What is table lookup in c?

632


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

676


why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

612