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


Please Help Members By Posting Answers For Below Questions

What is c++ used for today?

654


Why c is procedure oriented?

562


Why is not a pointer null after calling free?

587


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1121


pierrot's divisor program using c or c++ code

1720






which is an algorithm for sorting in a growing Lexicographic order

1388


If errno contains a nonzero number, is there an error?

792


What are the 5 data types?

592


What are types of structure?

598


Can we increase size of array in c?

531


List some basic data types in c?

553


How can type-insensitive macros be created?

690


What does c in a circle mean?

572


How do you print an address?

736


Explain c preprocessor?

674