C Program to check Strong Number

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, 4! = 4x3x2x1 and 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.

The output of the strong number in c program:

Strong number in C

Also, learn C programs.