Computer Science, asked by uxvenom14, 8 months ago

Write a javascript code to accept 2 numbers from user to display addition, subtraction, multiplication and division of two numbers.​

Answers

Answered by huzaifasiddiqui001
0

Answer:

Here the answer

Explanation:

1st Number : <input type="text" id="firstNumber" /><br>

2nd Number: <input type="text" id="secondNumber" /><br>

<input type="button" onClick="multiplyBy()" Value="Multiply" />

<input type="button" onClick="divideBy()" Value. ="Divide" />

Answered by brainlysme9
0

Javascript code to accept 2 numbers from user to display addition, subtraction, multiplication and division of two numbers is,

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

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

print("1. Addition 2.Subtract 3.Multiplication 4.Division")

choice = int(input("Enter your choice: "))

if(choice == 1):

   print("Addition of {} and {} = {}".format(a, b, a+b))

elif(choice == 2):

   print("Subtraction of {} and {} = {}".format(a, b, a-b))

elif(choice == 3):

   print("Multiplication of {} and {} = {}".format(a, b, a*b))

elif(choice == 4):

   print("Division of {} and {} = {}".format(a, b, a/b))

else:

   print("Wrong Choice")

Similar questions