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
What is infinite loop?
Difference between pass by reference and pass by value?
what is stack , heap ,code segment,and data segment
What is an array? What the different types of arrays in c?
What is #include cctype?
Which is better between malloc and calloc?
What are pointers?
What is spark map function?
If the size of int data type is two bytes, what is the range of signed int data type?
How do you redirect a standard stream?
Can you write the algorithm for Queue?
How many types of operators are there in c?
What is the most efficient way to store flag values?
how many errors in c explain deply
main() { printf("hello"); fork(); }