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 / giridhar
#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;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 ? | 27 Yes | 11 No |
Post New Answer View All Answers
What are the uses of null pointers?
how is the examination pattern?
Can we change the value of static variable in c?
In c language can we compile a program without main() function?
What is zero based addressing?
Here is a good puzzle: how do you write a program which produces its own source code as output?
Can you think of a logic behind the game minesweeper.
Why is c called c not d or e?
What is the difference between near, far and huge pointers?
What are directives in c?
What is a structural principle?
What does int main () mean?
Explain how does flowchart help in writing a program?
i got 75% in all semester am i eligible for your company
How to write a code for reverse of string without using string functions?