May 16, 2023

Modulus Operator JavaScript

Program to use ( % ) Modulus Operator JavaScript Language

let a = 5;
let b = 2;
let c;
c = a % b;
console.log('c = ', c);


c = 1

Steps Description

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

by : Suhel Akhtar

Quick Summary:

Modulus Operator JavaScript Program