0% found this document useful (0 votes)
1 views

JS Assignment Arithmetic Questions

The document contains a list of JavaScript programming assignments focused on using arithmetic and assignment operators. Each task requires writing a program to perform basic mathematical operations, such as addition, subtraction, multiplication, and division, as well as more complex calculations like area, temperature conversion, and interest calculation. Additionally, it includes tasks to demonstrate operator precedence, increment/decrement operations, and the use of parentheses in expressions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

JS Assignment Arithmetic Questions

The document contains a list of JavaScript programming assignments focused on using arithmetic and assignment operators. Each task requires writing a program to perform basic mathematical operations, such as addition, subtraction, multiplication, and division, as well as more complex calculations like area, temperature conversion, and interest calculation. Additionally, it includes tasks to demonstrate operator precedence, increment/decrement operations, and the use of parentheses in expressions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JavaScript Program Questions

Assignment and Arithmetic Operators


1. Write a program to add two numbers and display the result.

2. Write a program to subtract one number from another and show the result.

3. Write a program to multiply two numbers and print the result.

4. Write a program to divide two numbers and print the quotient.

5. Write a program to find the remainder of two numbers (modulus operator).

6. Write a program to calculate the square of a number using the * operator.

7. Write a program that assigns a number to a variable and increases it by 5 using += operator.

8. Write a program that decreases a variable by 10 using -= operator and prints the result.

9. Write a program to find the average of 3 numbers using arithmetic operators.

10. Write a program to calculate the area of a rectangle using area = length * width.

11. Write a program to convert temperature from Celsius to Fahrenheit using the formula: F = (C *

9/5) + 32

12. Write a program to find the simple interest using the formula: SI = (P * T * R) / 100

13. Write a program to swap values of two variables using a temporary variable and assignment

operator.

14. Write a program to calculate the result of the expression a + b * c / d and explain operator

precedence.

15. Write a program to demonstrate increment (++) and decrement (--) operators with a number.

16. Write a program to check whether a number is even or odd using the modulus operator.

17. Write a program to calculate the cube of a number using arithmetic and assignment operators.

18. Write a program to update a value with multiple assignment operations:

let x = 10;

x += 5;

x *= 2;
x -= 3;

console.log(x);

19. Write a program to input two numbers and print the sum, difference, product, quotient, and

remainder.

20. Write a program to demonstrate the effect of parentheses in an arithmetic expression, like:

let result1 = 10 + 5 * 2;

let result2 = (10 + 5) * 2;

You might also like