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
Is printf a keyword?
How many header files are in c?
What is null pointer in c?
What are the types of functions in c?
How will you delete a node in DLL?
How many keywords (reserve words) are in c?
Can the size of an array be declared at runtime?
What are valid operations on pointers?
Can you add pointers together? Why would you?
What is malloc and calloc?
Why do we write return 0 in c?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
What is the difference between break and continue?
What is function in c with example?
What is the general form of #line preprocessor?