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


Please Help Members By Posting Answers For Below Questions

Is printf a keyword?

750


How many header files are in c?

542


What is null pointer in c?

584


What are the types of functions in c?

560


How will you delete a node in DLL?

672






How many keywords (reserve words) are in c?

603


Can the size of an array be declared at runtime?

596


What are valid operations on pointers?

657


Can you add pointers together? Why would you?

633


What is malloc and calloc?

563


Why do we write return 0 in c?

542


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?

1561


What is the difference between break and continue?

598


What is function in c with example?

617


What is the general form of #line preprocessor?

574