In this string" if($i%2==)", what does the percent sign ask it to do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In this string" if($i%2==)", what does the percent sign ask it to do?

percent sign

20th Jul 2016, 8:42 PM
Joshua Lopez
Joshua Lopez - avatar
7 Answers
+ 3
find the rest of division by 2
21st Jul 2016, 4:23 AM
Diego Zabot
Diego Zabot - avatar
+ 1
find modulus
20th Jul 2016, 10:59 PM
hariharan
+ 1
5%2=1 As 5/2 leaves 1
21st Jul 2016, 8:54 AM
GlennV
+ 1
remainder.
21st Jul 2016, 12:18 PM
Devansh Sharma
Devansh Sharma - avatar
+ 1
is the modulo " the rest of division of the variable i by 2"
2nd Aug 2016, 2:07 PM
Marouane Mehdi
Marouane Mehdi - avatar
0
Excellent. Thank you gentleman. I think I have it now.
21st Jul 2016, 3:52 PM
Joshua Lopez
Joshua Lopez - avatar
0
it divisible by 2 and reminder will be stored in output..
29th Jul 2016, 2:48 AM
Manoj Kumar G
Manoj Kumar G - avatar