C - Modulo: %

Using the modulo operator we can calculate the remainder after integer division. by using the modulo operator we can easily test the divisibility of integers, if the result is 0, then the number is divisible without a remainder.

%

Description

par1 % par2
Used keywords: %

Input


Output

Examples

C

Modulo the possible of use:
x = 90 % 8;    // x = 2
y = 15 % 4;    // y = 3
z = (x % y) %5;// z = 2

C

Even one example in what situations we can use the operation modulo:
i % 4
121 % 40
(0xff % 50 % 10) % 2

C

Other pieces of example codes:
(1500 % 60)
 y = 15 % 4
70 % 8
(15 % 4)
 y = 1025 % 8

You can find it in the following collections: arithmetic operators
Languages: en hu cz sk