Modulus Operator JavaScript

Modulus Operator

On this page

Modulus Operator

Program to use ( % ) Modulus Operator JavaScript Language

let a = 11;
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 11 and 3 respectively a=11, b=3
  • Assign c variable with Assignment Operators (=) with the remainder/percentage value of variables a and b
  • a, b variables की value को (%) Modulus Operators ki सहयता से a%b numbers को remainder/percentage किया गया हैं
  • console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं