+ 3
What does the % in the line mean - if (x % 2 == 0)
Thanks
5 Antworten
+ 7
% is the modulus operator
the if condition checks if value x can be divided by 2 with no remainder
https://www.sololearn.com/discuss/270744/?ref=app
https://www.sololearn.com/discuss/158488/?ref=app
https://www.sololearn.com/discuss/97727/?ref=app
https://www.sololearn.com/discuss/75225/?ref=app
+ 1
Thank you both :)
0
is the remainder after division is 0, then the condition is true
0
what is the meaning oh i = i +1 in while loop??