Ticker

6/recent/ticker-posts

Strong number Program





Check whether number is strong or not -

Strong Number - Strong number is a special number whose sum of factorial of digits is equal to the original number.
#include <stdio.h>

int main()
{ 
  int n,f=1,s=0,r,i,n1;
  printf("Enter the number ");
  scanf("%d",&n);
  n=n1;
  while (n)
  {  
     r=n%10;
     for(i=1;i<=r;i++)
     {
       f=f*i;
     }
     s=s+f;
     n\=10;
  }
  if(s==n1)
  printf("Strong number");
  else
  printf("Not a Strong number");
return 0;
}

Output - 

145
Strong number

Post a Comment

0 Comments