Write a C program to enter any number and check whether number is Strong number or not. C program for strong numbers.

Since 1! + 4! + 5! = 145

Happy coding ;)

### Required knowledge:

Basic C programming, If else, For loop#### Strong number:

Strong numbers are the numbers whose sum of factorial of digits is equal to the original number.**Example:**145 is a strong numberSince 1! + 4! + 5! = 145

### Program:

/** * C program to check whether a number is Strong Number or not */ #include <stdio.h> int main() { int i, n, num, sum=0; long fact; /* * Reads a number from user */ printf("Enter any number to check Strong number: "); scanf("%d", &n); num = n; /* * Calculates sum of factorial of digits */ while(n!=0) { /* * Finds the factorial */ fact = 1; for(i=1; i<=n%10; i++) { fact = fact * i; } /* Adds the factorial to sum */ sum = sum + fact; n = n/10; } /* * If sum of factorial of digits is equal to original number then it is Strong number */ if(sum==num) { printf("\n%d is Strong number", num); } else { printf("\n%d is not Strong number", num); } return 0; }

Output

Enter any number to check Strong number: 145

145 is Strong number

145 is Strong number

Happy coding ;)

### You may also like

- Loop programming exercises index.
- C program to print all Strong numbers between 1 to n.
- C program to find the factorial of a number.
- C program to find all factors of a number.
- C program to find all Prime factors of a number.
- C program to find HCF(GCD) of any number.
- C program to find LCM of any number.
- C program to generate Fibonacci series up to n terms.
- C program to check whether a number is Armstrong number or not.
- C program to print all Armstrong number between 1 to n.
- C program to check whether a number is Perfect number or not.
- C program to print all Perfect numbers between 1 to n.
- C program to check whether a number is Prime number or not.
- C program to print all Prime numbers between 1 to n.

< code >< pre > -- Your source code -- < /pre >< /code > (Remove spaces from pre and code tags).