Answers for "multiply two numbers in python"

0

1. write a program to multiply two numbers using function python

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
Posted by: Guest on March-09-2021
0

multiplication of two or more numbers in python

# multiplication of two or more numbers
def multiple(*a):
    result = 1
    for i in a:
        result = result * i
    return result


# insert any number of arguments for multiplication, example:
res = multiple(12, 2, 5)
print(res)
# In this example, code output is = 120
Posted by: Guest on October-05-2020

Code answers related to "multiply two numbers in python"

Python Answers by Framework

Browse Popular Code Answers by Language