Python program to multiply two numbers
- Home
- Calculations
- Python program to multiply two numbers
- On
- By
- 2 Comments
- Categories: Calculations, multiply
Python program to multiply two numbers
Python program to multiply two numbers
In this tutorial, we will discuss Python program to multiply two numbers.
In this topic, we will learn how to multiply two integer number in the Python programming language
multiply two integer numbers
num1=int(input("Enter the first number: ")) #input value for variable num1 num2=int(input("Enter the second number: ")) #input value for variable num2 mul=num1*num2; #perform multiplication operation print("the product of given numbers is: ",mul) #display the product
When the above code is compiled and executed, it produces the following results
Enter the first number: 23 Enter the second number is: 32 the product of the given numbers is 736
This is a simple Python program to find the product of two integer numbers.
In the above program, we declared two different integer values such as 12 and 32 stored in variables num1, num2, respectively.
Then, we can find the product of given numbers using the * operator in Python
finally, we could display the result on the screen using the print() function in Python language.
multiply two floating point numbers
num1=float(input("Enter first number: ")) #input value for variable num1 num2=float(input("Enter second number: ")) #input value for variable num2 mul=num1*num2; #perform multiplication operation print("the product of given numbers is:",mul) #display the product
When the above code is compiled and executed, it produces the following results
Enter first number: 3.43 Enter second number:21.2 product of given numbers is: 72.716
This is a simple Python program to find the product of two floating point numbers.
In the above program, we declared two different floating point values such as 3.43 and 21.2 stored in variables num1, num2, respectively.
Then, we can find the product of given numbers using the * operator in Python
finally, we could display the result on the screen using the print() function in Python language.
Suggested for you
Similar post
Find product of two numbers using method in Java
Find product of two numbers using recursion in Java
Multiply two numbers in C language
Multiply two numbers in C++ language
Multiply two numbers in Python language
2 Comments
Charlie December 4, 2019 at 6:26 pm
Hello, how do I multiply an integer by a number, because i am making a program in python where you type your age then it shows you your age in years, months and days. when i try and do the command months = age*12 and do print(“You are”, months,”in months”) it just outputs the age 12 times.
Charlie December 4, 2019 at 6:27 pm
BTW 12 is the number you multiply by to get the months
nikki December 22, 2021 at 4:09 am
how to accept 2 number of float data types and find their product