Post Top Ad

Your Ad Spot

Pages

Sunday, 9 February 2020

Strong Number Checker Program

#include<stdio.h>
#include<conio.h>
// Factorial of ANy Number
int fact(int no)
{
int i,res=1;
for(i=no;i>0;i--)
{
res=i*res;
}
return res;
}

  int StrongNum(int no)
    {  
  int i,res=0,sum=0,temp=no;
  for(i=1;no;i++)
  {
     res=res*10+no%10;
no=no/10;
 
sum=sum+fact(res);
res=0;
  }
  return sum==temp;

void main()
{
  printf("%d",StrongNum(144));
}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages