Input 2 negative integers and print the product after removing the negative sign using mathematical functions in Python
Mathematical Functions - Question 1
In this question, we will see how to input two negative integer numbers and print the product of the numbers after removing their negative sign in Python programming using the mathematical functions. To know more about mathematical functions click on the mathematical functions lesson.
Q1) Write a program in Python to input two negative integer numbers and print the product of the numbers after removing their negative sign using the fabs() function.
Program
import math
print('Enter 2 negative integer numbers')
a=int(input())
b=int(input())
p=math.fabs(a) * math.fabs(b)
print('Product = %d' %(p))
Output
Enter 2 negative integer numbers -5 -8 Product = 40