# Print Strong Numbers From 1 To N C Program

## C Program To Print Strong Numbers From 1 To N

Learn How To Print Strong Numbers From 1 To N in C Programming Language. Check if a Number is a Strong Integer not in C Programming using Functions, While and For Loops. It is important that we should know **How A For Loop Works** before getting further with the C Program. Strong Number makes use of the **Factorial in C Programming**.

#### What is a Strong Number?

A Number is said to be a Strong Number if the Sum of the Factorials of the Digits of a Number is equal to the Number itself.

#### Example

**145 = (1!) + (4!) + (5!) 40585 = (4!) + (0!) + (5!) + (8!) + (5!)**

**Must Read: C Program To Check if a Number is Strong Number**

#### C Program To Print Strong Numbers from 1 To N

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 | #include <stdio.h> int main() { int count, j, temp, limit, sum = 0, fact; printf("\nEnter Limit:\t"); scanf("%d", &limit); printf("\nStrong Numbers Between 1 To %d\n", limit); for(count = 1; count <= limit; count++) { temp = count; while(temp != 0) { fact = 1; for(j = 1; j <= temp%10; j++) { fact = fact * j; } sum = sum + fact; temp = temp/10; } if(sum == count) { printf("%d\t", count); } } printf("\n"); return 0; } |

**Must Read: C Program To Calculate GCD of Two Integers**

#### Output

In case you get any Compilation Errors or any doubts in this C Program To Find Strong Integers, let us know about it in the Comment Section below.

Such a simple and easy program for finding strong numbers between 1 to 100. Can we use a separate function for calculating factorial to make it more modular?

You can definitely make a separate function to calculate factorial in this c program to print strong numbers from 1 to N. This technique will make your code more readable and easy to debug.