Question: In this lab, you will learn how to use arithmetic operators for performing various operations such as addition, subtraction, and so on . Complete the

In this lab, you will learn how to use arithmetic operators for performing various operations such as addition, subtraction, and so on.
Complete the given code in the JavaScript block by performing the following tasks:
Addition: Add the variables var1 and var2, and store the sum in the variable result.
Multiplication: Multiply the variables var1 and var2, and store the multiplication in the variable result.
Subtraction: Subtract the variables var1 and var2, and store the difference in the variable result.
Division: Divide the variables var1 and var2, and store the quotient in the variable result.
Modulus: Find the remainder of the variables var1 and var2, and store the remainder in the variable result.
Note: In the JavaScript block, replace the comments with the appropriate code, if required.
Sample input:
Copy
sum(10,20)
mul(5,4)
sub(30,20)
div(40,20)
rem(17,2)
Sample output:
Copy
The addition of variables is: 30
The multiplication of variables is: 20
The subtraction of variables is: 10
The division of variables is: 2
The remainder of variables is: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!