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 / vetrivel
#include<stdio.h>
int fact(int r)
{
if(r=0 || r=1)
return 1;
else
return(r*fact(r-1);
}
void main()
{
int a,n,rem,sum=0
printf("Enter the number\n");
scanf("%d",&n);
a=n;
while(n!=0)
{
rem=n%10;
sum=sum+fact(rem);
n=n/10;
}
if(sum==a)
printf("%d is a strong number",a);
else
printf("%d is not a strong number",a);
}
| Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
What is a constant and types of constants in c?
What does struct node * mean?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
What is a newline escape sequence?
What is include directive in c?
what is the height of tree if leaf node is at level 3. please explain
why wipro wase
What is strcmp in c?
What is the difference between malloc() and calloc() function in c language?
What is the collection of communication lines and routers called?
can we have joblib in a proc ?
Find MAXIMUM of three distinct integers using a single C statement
How do I use void main?
int i=10; printf("%d %d %d", i, i=20, i);
What is non linear data structure in c?