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
Explain how can I prevent another program from modifying part of a file that I am modifying?
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
Without Computer networks, Computers will be half the use. Comment.
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
What does the format %10.2 mean when included in a printf statement?
Is exit(status) truly equivalent to returning the same status from main?
What is a dynamic array in c?
What is the difference between strcpy() and memcpy() function in c programming?
while initialization of array why we use a[][2] why not a[2][]...?
What is a memory leak? How to avoid it?
What is the use of gets and puts?
Is that possible to store 32768 in an int data type variable?
Write a program to generate the Fibinocci Series
What is the difference between new and malloc functions?