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 c++ used for today?
Why c is procedure oriented?
Why is not a pointer null after calling free?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
pierrot's divisor program using c or c++ code
which is an algorithm for sorting in a growing Lexicographic order
If errno contains a nonzero number, is there an error?
What are the 5 data types?
What are types of structure?
Can we increase size of array in c?
List some basic data types in c?
How can type-insensitive macros be created?
What does c in a circle mean?
How do you print an address?
Explain c preprocessor?