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
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
What is the main difference between calloc () and malloc ()?
Explain the term printf() and scanf() used in c language?
What does typeof return in c?
Why c is faster than c++?
Explain how do you declare an array that will hold more than 64kb of data?
What is define directive?
What is a dynamic array in c?
What is the use of ?: Operator?
int far *near * p; means
When c language was developed?
Explain pointers in c programming?
Explain what are binary trees?
In c programming language, how many parameters can be passed to a function ?
Can a pointer be volatile in c?