Post Top Ad

Your Ad Spot

Pages

Sunday, 9 February 2020

Print Strong Nuber From A To B

#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;
}  // Strong Number OR NOT
   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 StrongNumUpton(int a,int b)
{
  int i;
  for(i=a;i<=b;i++)
  {
     if(StrongNum(i))

   printf(" \n%d",i);
}
  }
}

void main()
{
  StrongNumUpton(5,60000);
}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages