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

Enter any Number : 29

it is Special Number 


======================== 

Enter any Number : 30

it is not a Special Number 

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz