# C program to check whether a number is Strong number or not

## Write a C program to find number is Strong number or not.

In this program we will find number is strong number of not using C programming. Where the number should enter by a user. We will use the While Loop ,for loop and else if statement in this program. In that program we use user define function for find factorial of number t + 5!=1 + 24 +120=145

hat will use on find strong number.

Basically  A strong number is a number whose sum of factorials of digits is equal to the same number.

Ex:- number is 145

1! + 4!

So it is a strong number. ### Working:-

Step 1- first we enter the number.

Step 2- copy the number into any temporary variable.

Step 3- until temp is not equal to 0, calculate the following statement

(i)digit=temp%10

(ii)now we find the factorial of digit.

(iii)sum=sum+digit, add digit into a sum and store it in the sum.

(iv)temp=temp/10.divid the temp with 10

When temp became zero the above step stop to execute,

Step 4- if the sum of these factorial number is equal to the entered number,so it is the strong number.

Step 5- Stop.  ### C Program:-

`#include<stdio.h>//find factorial of a number.int factorial(int number)  {      //to initialize of factorial       int i,fact=1;     //use for loop with this condition     for(i=1;i<=number;i++)     {          //fact*=1;           fact=fact*i;      }  return fact;}//to main functionint main(){       //to initialize variables       int number,digit,sum=0,temp;       //To take user input       printf("Enter a number:");       scanf("%d",&number);       //To store a duplicity value of a given number       temp=number;      //use this whenever number is not equal to 0     while(temp!=0)     {          //for last digit          digit=temp%10;         //now we call of factorial function           digit = factorial(digit);         //to improve of a sum on digit           sum=sum+digit;           temp=temp/10;      }      //we check sum is equal to number its true       if(sum==number)      {          //display           printf("It is a Strong Number");      }      //false condition      else      {           //display           printf("It is not Strong Number");      }    return 0;}`

### Output:-

`Enter a number: 145It is a Strong NumberEnter a number: 123It is not Strong Number` 