Codeforcoding

Python code to multiply two floating-point numbers using function

Python code to multiply two floating-point numbers using function

In this tutorial, we will discuss the concept of Python code to multiply two floating-point numbers using function

In this topic, we are going to learn how to multiply two floating-point numbers using the function in Python language

Python code to multiply two floating-point numbers using function
multiply two floating-point numbers

What is multiplication

The multiplication is a method of combining a group of equal size. The multiplication is an arithmetic operation inverse of division

It is one of the four basic operation of arithmetic calculation others being addition,subtraction,division

The multiplication of two  numbers means, it is the operation one number is combining within another using multiply(*) operator.

 

The answer of a multiplication operation is called as “product”

 

Program to multiply of two floating-point numbers in Python

Program to find product of two  numbers

The program calculates the product of the given numbers using function in Python language

Program 1

#Python program to multiply two floating point numbers using function
def mul_Float(a,b):
    #function definition for multiply two numbers
    multiply=a*b
    #calculate multiplication of two numbers
    return multiply;
   #return value to main

num1=15.5;
num2=25.5
#variable de3laration and initailization

print("The product is: ",mul_Float(num1,num2))
#Call the functiion and display output

When the above code is executed, it produces the following result

The product is: 395.25

 

Program 2

Program to find product of two  numbers – takes  input from user

The program allows the user to enter two floating-point numbers and then it calculates the multiplication of the given numbers using function in Python language

#Python program to multiply two floating point numbers using function
def mul_Float(a,b):
    #function definition for multiply two numbers
    multiply=a*b
    #calculate multiplication of two numbers
    return multiply;
   #return value to main

num1=float(input("Enter the first number: "))
num2=float(input("Enter the second number: "))
#variable declaration and initailization

print("The product is: ",mul_Float(num1,num2))
#Call the functiion and display output

When the above code is executed, it produces the following result

Enter the first number: 12.3
Enter the second number: 13.2
The product is: 162.36

 

Suggested for you

Operator in Python

Data types in Python

 

Similar post

Find product of two numbers using function in Python

Find product of two numbers using recursion in Python

Multiply two numbers in C language

Multiply two numbers in C++ language

Multiply two numbers in Java language

 

Multiply of two floating-point numbers in Java

Multiply of two floating-point numbers in C

Multiply of two floating-point numbers in C++

Multiply of two floating-point numbers in Python

Multiplication of two floating-point numbers using method in Java
Multiplication program of two floating-point numbers using function in C
Exit mobile version