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 / rajesh kumar s

void main()

{
int n,t,f=1,s=0,num;
printf("enter the num \t:");
scanf("%d",&n);
num=n;
while(num)
{
t=num%10;
f=1;
while(t)
{
f=f*t;
t--;
}
s=s+f;
num=num/10;
}
if(n==s)
printf("%d is a strong number",n);
else
printf("%d is not a strong number",n);
}

Is This Answer Correct ?    83 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain high-order bytes.

670


What are the types of i/o functions?

671


In c programming language, how many parameters can be passed to a function ?

622


Write a program to print factorial of given number using recursion?

596


What is p in text message?

529






Explain what is the general form of a c program?

616


What is c language in simple words?

585


What is header file definition?

561


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

611


What is the equivalent code of the following statement in WHILE LOOP format?

758


What is a stream in c programming?

585


Subtract Two Number Without Using Subtraction Operator

347


What are the disadvantages of external storage class?

582


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

646


Why we use void main in c?

584