Programming Examples
Python program to check number is special or not
Write a Python Program which accept a number form user and check number is Special or Not.
Special number is a integer number which where addition of sum of digit and product of digits are same to number.
Example:
29:
2 + 9 = 11
2 x 9 = 18
11 + 18 = 29
Solution:
num=int(input("Enter any Number : "))
sum=0
product=1
temp=num
while num>0:
digit=num%10
sum=sum+digit
product=product*digit
num=num//10
if (product+sum)==temp:
print("it is Special Number ")
else:
print("it is not a Special Number ")
Output/ Explanation:
Enter any Number : 29
it is Special NumberÂ
========================Â
Enter any Number : 30
it is not a Special NumberÂ