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
How pointer is different from array?
How are variables declared in c?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
cavium networks written test pattern ..
What should malloc(0) do?
Why functions are used in c?
What are variables and it what way is it different from constants?
How can I remove the leading spaces from a string?
What is the difference between null pointer and wild pointer?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
Can a pointer point to null?
How can I recover the file name given an open stream or file descriptor?
What are the different types of C instructions?
Whats s or c mean?
Explain what is the difference between #include and #include 'file' ?