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 / nabanita dutta
#include<stdio.h>
#main()
{
int n,sum=0,r,f=1,i=1,m;
printf("enter anumber");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
for(i=1,f=1;i<=r;i++)
f=f*i;
sum=sum+f;
n=n/10;
}
if(sum==m)
printf("the given number is strong number");
else
printf("the given number is not a strong number");
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why can't I perform arithmetic on a void* pointer?
What are the storage classes in C?
Tell me what is null pointer in c?
What is a pointer value and address in c?
What is a pointer in c plus plus?
Can you write the algorithm for Queue?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
what is the role you expect in software industry?
What is realloc in c?
What is the use of sizeof?
What is the use of ?: Operator?
Explain how does free() know explain how much memory to release?
How can I read a binary data file properly?
What is d scanf?
Explain the difference between call by value and call by reference in c language?