Python Program to Multiply Two Numbers
This python program multiplies twoo numbers given by user and display output in standard output unit.
In this example, we first read two number from user using built-in function
input(). Since function
input() returns string value, we need to convert them to number type. And then given numbers are multiplied simply by
* operator to get desired result.
Python Source Code: Multiply Two Numbers
# Python program to find # multiply two numbers # Reading two numbers number1 = input('Enter first number: ') number2 = input('Enter second number: ') # Converting to float # Conversion is required because # input() function return string number1 = float(number1) number2 = float(number2) # Multiplication result = number1 * number2 # Displaying result print('%0.2f * %0.2f = %0.2f' % (number1, number2, result))
Enter first number: 12.23 Enter second number: 22.3 12.23 * 22.30 = 272.73