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 / rajesh kumar s
void main()
{
int n,t,f=1,s=0,num;
printf("enter the num \t:");
scanf("%d",&n);
num=n;
while(num)
{
t=num%10;
f=1;
while(t)
{
f=f*t;
t--;
}
s=s+f;
num=num/10;
}
if(n==s)
printf("%d is a strong number",n);
else
printf("%d is not a strong number",n);
}
Is This Answer Correct ? | 83 Yes | 17 No |
Post New Answer View All Answers
What is the difference between call by value and call by reference in c?
What is a program flowchart and explain how does it help in writing a program?
What is difference between arrays and pointers?
What are the basic data types associated with c?
Explain is it valid to address one element beyond the end of an array?
What does *p++ do? What does it point to?
Write a program in c to replace any vowel in a string with z?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
write a program for the normal snake games find in most of the mobiles.
Explain how do you print only part of a string?
What are run-time errors?
In a byte, what is the maximum decimal number that you can accommodate?
What are identifiers c?
How can I read and write comma-delimited text?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc