JS Assignment Arithmetic Questions
JS Assignment Arithmetic Questions
2. Write a program to subtract one number from another and show the result.
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.
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.
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;