Strong Number:-
A number is called strong number If the sum of factorial of the digits in any number is equal the given number then the number is called as STRONG number
For Example:- 145 is strong number because factorial sum of digits 1! + 4! + 5! = 145
C program to check Strong number
#include <stdio.h> int main() { int i, original_number, num, last_digit, sum; long fact; /* Take Input a number from user */ printf("Enter the number you want to check Strong number: "); scanf("%d", &num); /* Copying the value of num to a temporary variable */ original_number = num; sum = 0; /* Finding sum of factorial of digits */ while(num > 0) { /* Get last digit of num */ last_digit = num % 10; /* Find factorial of last digit */ i=1, fact = 1; while(i<=last_digit) { fact=fact*i; i++; } sum = sum + fact; num = num / 10; } /* Now check Number is Strong number or not */ if(sum == original_number) { printf("%d is STRONG NUMBER", original_number); } else { printf("%d is NOT STRONG NUMBER", original_number); } return 0; }
Output:-