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
Explain what are the different file extensions involved when programming in c?
What is the difference between class and object in c?
How was c created?
What are the types of arrays in c?
c program to compute AREA under integral
What are pointers in C? Give an example where to illustrate their significance.
What is extern c used for?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
how can use subset in c program and give more example
Write a program to find factorial of a number using recursive function.
Where is c used?
What are global variables and how do you declare them?
What is the use of function overloading in C?
How do I get an accurate error status return from system on ms-dos?
What is the difference between procedural and declarative language?