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 / valli
int fact(int f)
{
if(f==1||f==0)
return 1;
else
return(f*fact(f-1));
}
main()
{
int n,i,j,s=0;
printf("enter the number");
scanf("%d",&n);
i=n;
while(n!=0)
{
j=n%10;
s=s+fact(j);
n=n/10;
}
if(i==s)
printf("strong number");
else
printf("not a strong number");
}
| Is This Answer Correct ? | 12 Yes | 8 No |
Post New Answer View All Answers
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is pointer to pointer in c language?
How many loops are there in c?
Explain about C function prototype?
What is the best style for code layout in c?
What is meant by high-order and low-order bytes?
What are terms in math?
What are the advantages and disadvantages of a heap?
What is self-referential structure in c programming?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
How does normalization of huge pointer works?
please give me some tips for the placement in the TCS.
Explain Basic concepts of C language?
What does the c in ctime mean?
What is call by value in c?