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 the 3 types of structures?

558


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

702


write a program for the normal snake games find in most of the mobiles.

1776


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

555


Why is this loop always executing once?

607






When should I declare a function?

613


FILE PROGRAMMING

1771


Explain is it better to bitshift a value than to multiply by 2?

703


program for reversing a selected line word by word when multiple lines are given without using strrev

1936


What is the purpose of main() function?

648


In a byte, what is the maximum decimal number that you can accommodate?

618


Explain what are multibyte characters?

615


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

1569


Why is c not oop?

533


What is static function in c?

621