How to multiply inputs in python {Multiply In Python With Examples} [python code]

Example:1

print(2*3)

Output
6

Example: 2

num_1 = input("Enter the first number")
num_2 = input("Enter the second number")

product = float(num_1) * float(num_2)

print("Product of {} and {} is {}".format(num_1, num_2,product))

Output
Enter the first number 5
Enter the second number 5
Product of 5 and 5 is 10.00

Example: 3

num1=float(input("Enter first number: "))

#input value 
num2=float(input("Enter second number: "))

#input value  
mul=num1*num2;

#perform multiplication operation
print("the product of given numbers is:",mul)
#display the product

Output
Enter first number: 5.30
Enter second number:2.20
product of given numbers is: 7.50

Example: 4

num1=int(input("Enter the first number: "))

#input num1
num2=int(input("Enter the second number: "))

#input num2
mul=num1*num2;

# multiplication 
print("the product of given numbers is: ",mul)
#display the product

Output
Enter the first number: 6
Enter the second number is: 8
the product of the given numbers is 14

Example: 5

#Python  multiply two numbers

x=50
y=20

mul = x * y;
print("Multiplication of two numbers: ",mul)

Output
Multiplication of two numbers: 1000

Example: 6

# the program is
p = int(input("Enter first number: "))
q = int(input("Enter second number: "))

result = p * q;

print("Multiplication of two numbers:", result)

Output
Enter first number: 5
Enter second number: 4
Multiplication of two numbers: 20

Example: 7

def multiplication(x, y):
    z = x * y
    return z


p = int(input("Enter first number: "))
q = int(input("Enter second number: "))

result = multiplication(p, q)
print("Multiplication of two numbers:", result)

Output
Enter first number: 4
Enter second number: 2
Multiplication of two numbers: 8

Example: 8

def multiply(x,y):
    if(x<y):
        return multiply(y,x)
    elif(y!=0):
        return (x+multiply(x,y-1))
    else:
        return 0

x=int(input("Enter first number: "))
y=int(input("Enter second number: "))

print("Multiplication of numbers is ", multiply(x,y))

Output
Enter first number: 15
Enter second number: 2
Multiplication of numbers is 30

Example: 9

# Reading numbers
number1 = input('Enter first number: ')
number2 = input('Enter second number: ')

# Converting to float
number1 = float(number1)
number2 = float(number2)

# Multiplication
result = number1 * number2

# Displaying result
print('%0.2f * %0.2f = %0.2f' % (number1, number2, result))

Output
Enter first number: 2.50
Enter second number: 20.30
2.50 * 20.30 = 22.80

Keywords:

how to multiply inputs in python {Multiply In Python With Examples} [python code]
python program to multiply two numbers using function,
python program to multiply two numbers without using operator,
multiply variables in python,
how to multiply inputs in python,
python multiply list,
write a program to multiply given two integers and display the result. python,
python program to divide two numbers,
multiplication in python using for loop,
Can you multiply two variables in Python?,
How does Python calculate multiplication?,
How do you write a multiplication code in Python?,
How do you multiply multiple inputs in Python?,

Spread the love

Leave a Comment

Your email address will not be published.

Scroll to Top