Take a two digit positive integer as input from the user, and find the product of it’s digits. print the product of the digits if the product is below 25, otherwise print “invalid”.
Constraints
1 <= input_length <= 25
Input is a 2 digit positive integer
Sample Input 0
27
Sample Output 0
14
Explanation 0
Explanation: In the sample test case1 product of digits is 14 i.e. below 25, so the output is 14.
In sample test case 2, the product of digits is 27 i.e not below 25 so the output is “invalid”
Sample Input 1
39
Sample Output 1
invalid
Solution
Approach:
The input is taken in the variable n.
The input is taken in the variable m.
If the product of the two numbers is less than 25, then the product is printed.
If the product of the two numbers is greater than 25, then the output is invalid.
n,m = input()
if int(n)*int(m) < 25:
print(int(n)*int(m))
else:
print("invalid")
Happy Learning – If you require any further information, feel free to contact me.