- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Python Program to Check if a Number is a Strong Number

Strong number is a number whose sum of all digits’ factorial is equal to the number ‘n’. Factorial implies when we find the product of all the numbers below that number including that number and is denoted by ! (Exclamation sign), For example: 5! = 5x4x3x2x1 = 120. When it is required to check if a number is a strong number or not, the remainder/modulus operator and the ‘while’ loop can be used.

Below is the demonstration of the same −

## Example

my_sum=0 my_num = 296 print("The number is") print(my_num) temp = my_num while(my_num): i=1 fact=1 remainder = my_num%10 while(i<=remainder): fact=fact*i i=i+1 my_sum = my_sum+fact my_num=my_num//10 if(my_sum == temp): print("The number is a strong number") else: print("The number is not a strong number")

## Output

The number is 296 The number is not a strong number

## Explanation

A sum is initialized to 0.

The number is defined and is displayed on the console.

The number is defined to a temporary variable.

The while loop is used where the remainder is determined.

The while loop is used again to see whether the iterator is less than or equal to the remainder.

If it is less, the ‘fact’ variable is multiplied with the iterator.

It is then incremented by 1.

The sum value is added to the ‘fact’ variable.

If the ‘temp’ variable and the sum are equal, it is considered a string number.

- Related Questions & Answers
- Write a Python program to find if a number is strong number or not
- Python Program to Check if a Number is a Perfect Number
- C Program to check Strong Number
- Python program to check if the given number is a Disarium Number
- Golang Program to Check if a Number is a Perfect Number
- Python Program for How to check if a given number is a Fibonacci number?
- How to check if a given number is a Fibonacci number in Python Program ?
- Python program to check if a number is Prime or not
- Python program to check if a given string is number Palindrome
- Python program to check if the given number is Happy Number
- Java Program for check if a given number is Fibonacci number?
- Python Program to Check if a Number is Positive, Negative or 0
- Java Program to check if a string is a valid number
- Bash program to check if the Number is a Palindrome?
- Write a C# program to check if the entered number is Armstrong number?