0

what does it(%) mean?

I can't understand what its function is. Give me examples please

7th Aug 2016, 12:09 AM
Itzia Paulina
Itzia Paulina - avatar
2 Answers
+ 4
% is a modulus operator, and it is used to return the remainer of a division. For example: 5 % 2 = 1 10 % 5 = 0 30 % 7 = 2 A very common, and beginner way to use the modulus is to tell whether or not a number is even: if (x % 2 == 0) { //even } else { //odd }
7th Aug 2016, 12:13 AM
Cohen Creber
Cohen Creber - avatar
+ 1
modulus operator ,used to get remainder in divison
7th Aug 2016, 2:26 PM
Kamaganiguntla Seshareddy
Kamaganiguntla Seshareddy - avatar