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


Please Help Members By Posting Answers For Below Questions

What is the difference between call by value and call by reference in c?

616


What is a program flowchart and explain how does it help in writing a program?

670


What is difference between arrays and pointers?

578


What are the basic data types associated with c?

811


Explain is it valid to address one element beyond the end of an array?

729






What does *p++ do? What does it point to?

613


Write a program in c to replace any vowel in a string with z?

687


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

603


write a program for the normal snake games find in most of the mobiles.

1783


Explain how do you print only part of a string?

647


What are run-time errors?

598


In a byte, what is the maximum decimal number that you can accommodate?

624


What are identifiers c?

560


How can I read and write comma-delimited text?

616


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

5054