STRONG NUMBER
A number can be said as a strong number when the sum of the factorial of the individual digits is equal to the number.
Write a program to check whether the given number is Strong number or not.
Input: Positive number
Output: Display the appropriate message
Refer sample input and output for formatting specification.
INPUT: 145
OUTPUT: The number is a strong number
num=int(input("Positive number: ")) sum,temp = 0,num while(num): i = 1 f = 1 r = num%10 while(i<=r): f = f*i i = i+1 sum = sum+f num = num//10 if(sum == temp): print("The number is a strong number") else: print("The number is not a strong number")
INPUT_1:
Positive number: 143
OUTPUT:
The number is not a strong number
INPUT_2:
Positive number: 145
OUTPUT:
The number is a strong number
INPUT_3:
Positive number: 166
OUTPUT:
The number is not a strong number
INPUT_4:
Positive number: 200
OUTPUT:
The number is not a strong number
ILLUSTRATION
Morae Q!
- Program to get dictionary items, use update module and items module.
- Regular expression allowing certain set of characters.
- Compute the Sum of Cosine Series.
- Find the Sum of Sine Series.
- Remove the Vowels from the string.
- Find All Non-Overlapping strings/characters using regular expressions .
- Check whether the given string is Panagram or not.
- Replacing strings using Regular Expression Regex.
- Check whether the given number is Strong number or not.
- Find the numbers divisible by a input numbers within the given range.
- Change the behaviour of the Regular Expression using flags.
- Find the exponentiation of a number.
- Find all prime numbers in a range using Sieve of Eratosthenes.
- Convert decimal equivalent into binary, hexadecimal and octal.
- Compute the area of a farmers field in feet.
- Compute time from number of days/hours to seconds.
- Precompiled patterns using Regular Expressions .
- Compute the price of the cake on the nth day.
- Compute the number of possible non-increasing arrays.
- Find the type of spinach using the calorie value.