Example to show Modulus operator
10 % 3
equals1
because 10 divided by 3 is 3 with a remainder of 1.15 % 4
equals3
because 15 divided by 4 is 3 with a remainder of 3.8 % 2
equals0
because 8 divided by 2 is exactly 4 with no remainder.
Modulus Operator in Programming
The modulus operator, often represented by the symbol ‘%'
, is a fundamental arithmetic operator used in programming languages to find the remainder of a division operation between two numbers. It returns the remainder of dividing the first operand by the second operand.
Table of Content
- What is the Modulus Operator?
- Basic Syntax of Modulus Operator
- How Modulus operator works?
- Properties of Modulus operator
- Example to show Modulus operator
- Modulus Operator in C
- Modulus Operator in C++
- Modulus Operator in Java
- Modulus Operator in Python
- Modulus Operator in C#
- Modulus Operator in Javascript
- Uses or Application of Modulus Operator
- Performance Considerations of Modulus Operator
Contact Us