Programming Examples

Python program to check number is special or not


special

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 

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad