Calculations

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

Operator in Python

Data types in Python

 

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

 

CPP program to multiply two numbers
C program to multiply two numbers using function
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

View Comments

  • 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.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

1 month ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

1 month ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

2 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

5 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

10 months ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

10 months ago