Computer Science, asked by neelamsingha943, 1 month ago

Write a Python program to do the addition, subtraction , multiplication

and division of two numbers.​

Answers

Answered by saransrini03
12

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

b = int(input("Enter the second number : "))

c = a+b

print(c)

c=a-b

print(c)

c=a*b

print(c)

c=a/b

print(c)

Answered by sadiaanam
3

Answer: Here is an example of a Python program that performs addition, subtraction, multiplication, and division of two numbers:

# Take input from the user

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

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

# Addition

print("The sum of", num1, "and", num2, "is", num1 + num2)

# Subtraction

print("The difference of", num1, "and", num2, "is", num1 - num2)

# Multiplication

print("The product of", num1, "and", num2, "is", num1 * num2)

# Division

print("The quotient of", num1, "and", num2, "is", num1 / num2)

Explanation:

# Take input from the user

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

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

# Addition

print("The sum of", num1, "and", num2, "is", num1 + num2)

# Subtraction

print("The difference of", num1, "and", num2, "is", num1 - num2)

# Multiplication

print("The product of", num1, "and", num2, "is", num1 * num2)

# Division

print("The quotient of", num1, "and", num2, "is", num1 / num2)

In this program, we first take input from the user for two numbers (num1 and num2) using the input() function. The input function returns the input as a string, so we use the float() function to convert the input to a floating-point number.

Then we perform addition, subtraction, multiplication, and division on the two numbers using the appropriate operators (+, -, *, and /) and print the results using the print() function.

for more visit - https://brainly.in/question/17632241

#SPJ3

Similar questions