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 is wrong with this statement? Myname = 'robin';
Is it cc or c in a letter?
What is nested structure with example?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Where are c variables stored in memory?
Write a program to swap two numbers without using third variable?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
Explain bitwise shift operators?
Explain the difference between structs and unions in c?
Why cant I open a file by its explicit path?
How can you convert integers to binary or hexadecimal?
Can a function argument have default value?
What are control structures? What are the different types?