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 / raghuram
#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 ? | 7 Yes | 6 No |
Post New Answer View All Answers
What is the use of void pointer and null pointer in c language?
When would you use a pointer to a function?
When should a far pointer be used?
What is a null pointer in c?
Explain how do you use a pointer to a function?
With the help of using classes, write a program to add two numbers.
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
How many bytes are occupied by near, far and huge pointers (dos)?
Explain what is a pragma?
What are extern variables in c?
What is the use of f in c?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
What is c variable?
program for reversing a selected line word by word when multiple lines are given without using strrev
Explain what is the best way to comment out a section of code that contains comments?