This article is based on a Strong number in C. You will learn to check whether the number is a strong number or not in C program.

## What is Strong Number?

The number whose sum of the factorials of digits is equal to the original number then the number is called a Strong number. **For example:** 145 is a strong number. since `1! + 4! + 5! = 145`

(Here

, **1!** = 1

and **4! **= 4x3x2x1

).**5!** = 5x4x3x2x1

## C program to check whether the entered number is strong or not.

**Explanation:** In the following C program for Strong number we take the user input for integer and separate the digits using modulus(**%** gives us remainder) operator and sum the factorial of those each digit `sum += fact;`

. Factorial of a number is calculated after the remainder(rem) and then added. Divide the entered number by 10 (`temp = temp / 10;`

) for the next iteration.

The While loop runs until the number is not equal to 0 and store the result in the sum variable. At last, check, if the **sum **is equal to the original number or not and print accordingly.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h> int main() { int i, originalNum, temp, rem, sum = 0; int fact; //user input printf("Enter the number you wish to check: "); scanf("%d", &originalNum); temp = originalNum; //sum of the factorial while (temp != 0) { //getting remainder rem = temp % 10; //calculate factorial of a number fact = 1; for (i = 1; i <= rem; i++) { fact = fact * i; } //adding factorial to sum for result sum += fact; temp = temp / 10; } //check for result and display if (sum == originalNum) { printf("%d is a Strong Number.", originalNum); } else { printf("%d is NOT a Strong Number.", originalNum); } return 0; } |

The **output **of the strong number in c program:

Also, learn **C programs**.