Computer Science, asked by veenus1904, 10 months ago

python code for input a number and check number a is special number or not

Answers

Answered by ArchBTW
0

Answer:

def specialNumber(n):

# Checking whether entered

# number is 2 digit or not

if (n < 10 or n > 99):

 print("Invalid Input! Number",

  " should have 2 digits only")

else:

 # Finding the first digit

 first = n // 10

 

 # Finding the last digit

 last = n % 10

 

 # Finding the sum

 # of the digits

 sum = first + last

 

 # Finding the product

 # of the digits

 pro = first * last

 

 if ((sum + pro) == n):

 

  print(n ," is a Special ",

   "Two-Digit Number")

 else:

 

  print(n , " is Not a ",

   "Special Two-Digit Number")

 

n = 59

specialNumber(n)

# by Anant Gupta.

Explanation:

Similar questions