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 / raghuram
#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,f=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 ? | 7 Yes | 6 No |
Post New Answer View All Answers
Explain the difference between call by value and call by reference in c language?
Explain how many levels deep can include files be nested?
What does & mean in scanf?
Is it better to use a macro or a function?
What is substring in c?
Why do we use null pointer?
Is it cc or c in a letter?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Define Array of pointers.
How many levels of indirection in pointers can you have in a single declaration?
How we can insert comments in a c program?
What is the difference between call by value and call by reference in c?
List the variables are used for writing doubly linked list program.
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.