C Programming
- Print integer
- Add & subtract
- Odd & even
- Multiply & divide
- Check vowels
- Letter grade program
- Leap year program
- Sum of digits
- Prime numbers
- Sum of numbers
- Find factorial
- Fibonacci series
- Fibonacci triangle
- Number triangle
- Alphabet triangle
- Armstrong numbers
- Palindrome numbers
- Swap number
- Reverse number
- Decimal to binary
- Assembly code in C
- Matrix multiplication
- HCF & LCM
- nCr & nPr
- Print pattern
- Floyd’s triangle
- Pascal triangle
- Count digits
- Strong numbers
- Perfect numbers
- Sum of natural number
- Binary to decimal
- Decimal to octal
- Octal to decimal
- Binary to octal
- Octal to binary
- Add using pointer
- Bubble sort
- Insertion sort
- Selection sort
- Quick sort
- Binary search
- Linear search
- Largest element of array
- Smallest element of array
- Reverse Array
- Variable size & limit
- ASCII value of character
- Sum of array elements
- Number of element in array
- Merge two array
- Insert element in array
- Delete element from array
- Add two matrix
- Transpose matrix
- Print string
- Reverse string
- Delete vowels
- Sort string
- Remove spaces
- Swap string
- Random numbers
- Print date & time
- Print IP address
- Shut down computer
What is a strong number?
A number can be said as a strong number if the sum of factorial of all the digits is equal to the number. To check that a number is strong number or not, we have to determine the sum of factorial of all the digits of that number. Then, if the sum is = number then the number will be a strong number.
Now, lets think about a number 263. The value of this number is 263. Let’s determine the sum of factorial of digits for this number.
2! + 6! + 3!
= 2 + 720 + 6
728
We all are well clear that 263 is not equal to 728. And for this 263 is not a strong number.
Let’s think about another number which is 145.
1! + 4! + 5!
1 + 24 + 120
145
Here, 145 is equal to 145. So, 145 will be a strong number.
Here in this article we will see some program related to strong number in C. So, let’s get started.
Check strong number program in C
In this program we will take the number from user and check. If the number is a strong number then we will print the number is strong otherwise not. Let’s go to the code.
// checking strong number program in C
#include <stdio.h>
int fact_funct(int rem){
int c, multiply = 1;
for(c = 1; c <= rem; c++){
multiply *= c;
}
return multiply;
}
int main(){
int number, factorial, reminder, i, sum = 0;
printf("Enter a number number to check strong : ");
scanf("%d",&number);
i = number;
while(i != 0){
reminder = i % 10;
int factorial = fact_funct(reminder);
i /= 10;
sum += factorial;
}
if(sum == number){
printf("\n%d is a strong number.\n", number);
}else{
printf("\n%d is not a strong number.\n", number);
}
return 0;
}
Output of this strong number program :


C program to print n strong numbers
In this program we will take an integer input from the user and print all the strong number between 1 to n. We can do the program using some different way. Let’s see how the program looks like.
// print n strong numbers
#include<stdio.h>
int factorials(int fact){
int j, multiply = 1;
for(j = 1; j <= fact; j++){
multiply *= j;
}
return multiply;
}
int main(){
int c, d, num, rem, f = 1, sum = 0;
printf("Enter the number n here : ");
scanf("%d",&num);
printf("\nStrong numbers from 1 to %d are : \n", num);
for(c = 1; c <= num; c++){
d = c;
while(d != 0){
rem = d % 10;
f = factorials(rem);
d = d / 10;
sum = sum + f;
}
if(sum == c){
printf("%d ", c);
}
sum = 0;
}
return 0;
}
Output :
Enter the number n here : 5000
Strong numbers from 1 to 5000 are :
1 2 145
Find strong numbers between two integer
This program will find all the strong numbers between your given range. We will take two integer from the user. First will be the lower limit and last integer will be the upper limit. Then we will find all the strong numbers between two given integers.
// strong numbers between two given range
#include<stdio.h>
int func_fact(int fact);
int main(){
int num1, num2, f = 1, sum = 0, rem, j, c;
printf("Enter the first number here : ");
scanf("%d",&num1);
printf("\nEnter the last number here : ");
scanf("%d",&num2);
printf("\nStrong numbers between %d and %d are : \n", num1, num2);
for(j = num1; j <= num2; j++){
c = j;
while(c != 0){
rem = c % 10;
f = func_fact(rem);
c = c / 10;
sum += f;
}
if(sum == j){
printf("%d, ", j);
}
sum = 0;
}
return 0;
}
int func_fact(int fact){
int k, multiply = 1;
for(k = 1; k <= fact; k++){
multiply = multiply * k;
}
return multiply;
}
Output of this program :
Enter the first number here : 2
Enter the last number here : 500
Strong numbers between 2 and 500 are :
2, 145,
Previous page:Â Count digits program
Next page:Â Perfect number program