How to use Arithmetic Operators JavaScript Language

Arithmetic Operators

Addition Operator

Program to use ( + ) Addition Operator JavaScript Language

let a = 5;
let b = 3;
let c;
c = a + b;
console.log('c = ', c);

Output Addition

c = 8

Steps Description

  • Declare three variables a, b and c
  • Initialize both variables with value of 5 and 3 respectively a=5, b=3
  • Assign c variable with Assignment Operators (=) with the sum/Addition value of variables a and b
  • a, b variables की value को (+) Addition Operators ki सहयता से a+b numbers को sum/Addition किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं

Subtraction Operator

Program to use ( – ) Subtraction Operator JavaScript Language

let a = 5;
let b = 3;
let c;
c = a - b;
console.log('c = ', c);

Output

c = 2

Steps Description

  • Declare three variables a, b and c
  • Initialize both variables with value of 5 and 3 respectively a=5, b=3
  • Assign c variable with Assignment Operators (=) with the subtraction/minus value of variables a and b
  • a, b variables की value को (-) Subtraction Operators ki सहयता से a-b numbers को subtraction/minus किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं

Multiplication Operator

Program to use ( * ) Multiplication Operator JavaScript Language

let a = 5;
let b = 3;
let c;
c = a * b;
console.log('c = ', c);

Output Multiplication

c = 15

Steps Description

  • Declare three variables a, b and c
  • Initialize both variables with value of 5 and 3 respectively a=5, b=3
  • Assign c variable with Assignment Operators (=) with the multiplie/गुड़ा value of variables a and b
  • a, b variables की value को (*) Multiplication Operators ki सहयता से a*b numbers को multiplie/गुड़ा किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं

Division Operator

Program to use ( / ) Division Operator JavaScript Language

let a = 15;
let b = 3;
let c;
c = a / b;
console.log('c = ', c);

Output Division

c = 5

Steps Description

  • Declare three variables a, b and c
  • Initialize both variables with value of 15 and 3 respectively a=15, b=3
  • Assign c variable with Assignment Operators (=) with the divides/भाग value of variables a and b
  • a, b variables की value को (/) Division Operators ki सहयता से a/b numbers को divides/भाग किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं

Modulus/Remainder Operator

Program to use ( % ) Modulus/Remainder Operator JavaScript Language

let a = 10;
let b = 3;
let c;
c = a % b;
console.log('c = ', c);

Output Modulus/Remainder

c = 1

Steps Description

  • Declare three variables a, b and c
  • Initialize both variables with value of 10 and 3 respectively a=10, b=3
  • Assign c variable with Assignment Operators (=) with the modulus/remainder value of variables a and b
  • a, b variables की value को (%) Modulus/Remainder Operators ki सहयता से a%b numbers को modulus/remainder किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं

Increment Operators Operator

Program to use ( ++ ) Increment Operators JavaScript Language

let b = 3;
console.log('b = ',b)
console.log('++b = ',++b)
console.log('b++ = ',b++)

Output Increment Operators

b = 3 , ++b = 4 , b++ = 4

Steps Description

  • Declare variable b
  • Initialize variable with value of 3 respectively b=3
  • console.log inbuilt function की मदद्द से b variable की value को display किया गया हैं
  • console.log inbuilt function की मदद्द से (++) Increment Operators की सहयता से (++b) prefix Increment numbers किया और b variable की value को display किया गया हैं
  • console.log inbuilt function की मदद्द से (++) Increment Operators ki सहयता से (b++) postfix Increment numbers किया और b variable की value को display किया गया हैं

Decrement Operators Operator

Program to use ( — ) Decrement Operators JavaScript Language

let a = 5;
console.log('a = ',a)
console.log('--a = ',--a)
console.log('a-- = ',a--)

Output Decrement Operators

a =  5 , --a = 4 , a-- = 4

Steps Description

  • Declare variable a
  • Initialize variable with value of 5 respectively a=5
  • console.log inbuilt function की मदद्द से a variable की value को display किया गया हैं
  • console.log inbuilt function की मदद्द से (–) Decrement Operators की सहयता से (–a) prefix Decrement numbers किया और a variable की value को display किया गया हैं
  • console.log inbuilt function की मदद्द से (–) Decrement Operators ki सहयता से (a–) postfix Decrement numbers किया और a variable की value को display किया गया हैं

Exponentiation Operators Operator

Program to use ( ** ) Exponentiation Operators JavaScript Language

let a = 5;
let b = 3;
let c;
c = a ** b;
console.log('c = ', c);

Output Exponentiation Operators

c = 125

Steps Description

  • Declare three variables a, b and c
  • Initialize both variables with value of 5 and 3 respectively a=5, b=3
  • Assign c variable with Assignment Operators (=) with the Exponentiation value of variables a and b
  • a, b variables की value को (**) Exponentiation Operators ki सहयता से a*b numbers को Exponentiation (5**3 / 5*5*5 = 125) किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं