multiply

Python program to multiply two number using function

Python program to multiply two number using the function

In this tutorial, we will discuss the Python program to multiply two number using the function

In this topic, we will learn a simple concept of how to multiply two numbers using the function in the Python programming language

already we will know the same concept using the operator in Python

if you know click here Python program to multiply two numbers

Python program to multiply integer number

Program 1

#Python program to multiply two numbers using function

def mul_Num(a,b):#function for find product
    multiply=a*b;
    return multiply; #return value

num1=25  #variable declaration
num2=55
print("The product is",mul_Num(num1,num2))#call te function

When the above code is compiled and executed, it produces the following results

The product is 1375

 

program to multiply integer number– get input from the user

#Python program to multiply two numbers using function

def add_num(a,b):#function for multiplication
    multiply=a*b;
    return multiply; #return value
num1=int(input("input the number one: "))#input from user for num1
num2=int(input("input the number one: "))#input from user for num2

print("The product is",add_num(num1,num2))#call te function

When the above code is compiled and executed, it produces the following results

input the number one: 24
input the number one: 12
The sum is 288

 

program to multiply floating point number

Program 1

#Python program to multiply two numbers using function

def mul_Num(a,b):#function for multiplication
    multiply=a*b;
    return multiply; #return value

num1=2.456 #variable declaration
num2=55.54
print("The product is",mul_Num(num1,num2))#call the function

When the above code is compiled and executed, it produces the following results

The product is 136.40624

 

program to multiply floating point number – get input from the user

#Python program to multiple two numbers using function

def mul_Num(a,b):#function for multiplication
    multiply=a*b;
    return multiply; #return value
num1=float(input("input the number one: "))#input from user for num1
num2=float(input("input the number one: "))#input from user for num2

print("The sum is",mul_Num(num1,num2))#call te function

When the above code is compiled and executed, it produces the following results

input the number one: 34.56
input the number one: 2.34
The sum is 80.8704

 

Suggested for you

Python function

Operator Python

 

Cpp program to add two numbers using function
Java code to calculate electricity bill
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.

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