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 main () in c?
What is operator precedence?
What are the uses of a pointer?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
What is memory leak in c?
How many header files are in c?
What are Macros? What are its advantages and disadvantages?
What are the primitive data types in c?
What is the maximum no. of arguments that can be given in a command line in C.?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
Is c procedural or functional?
Why is c called c not d or e?
What is the scope of static variable in c?
Dont ansi function prototypes render lint obsolete?
What is c programing language?