Contact Learn C
Copy

Program 383: Find N Strong Numbers

Program 383: Find N Strong Numbers
 
#include<stdio.h>
#include<math.h>
int GetFactorial(int number);
main()
{
  int num,i,j,temp1,temp2,sum=0;;
  printf("Enter a number to know all Strong number between them\n");
  scanf("%d",&num);
  printf("Strong numbers are:\n");
  for(i=1;i<=num;i++)
  {
    sum=0;
    temp1=i; 
    temp2=i; 
    while(temp1>0)
    {
      j=temp1%10;
      sum+=GetFactorial(j);
      temp1=temp1/10;
    }
    if(sum==temp2)
    {
      printf("%d\n",sum);
    }
  }
}

int GetFactorial(int number)
{
 int factorial=1,i;
  for(i=1;i<=number;i++)
  {
   factorial=factorial*i;
  }
  return factorial;
}
Explanation:
 //Coming Soon


Output:
Find N Strong Numbers


Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide