I still don't get the % sign | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

I still don't get the % sign

What does it do? help

16th Jun 2017, 8:16 AM
Dánjal Eliassen
Dánjal Eliassen - avatar
5 Respuestas
+ 2
it's called the modulo or remainder operator, it returns the remaining number after dividing the first number by the second. eg: 9/2 gives 4.5 to quickly get the remainder just multiply the decimal place (.5) by the divisor (2), this gives 1. so 9%2 = 1;
16th Jun 2017, 8:22 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 2
% Is the remainder . Like if you have 5 and someone asks you how many times can you put 2 inside of 5, Well 2 times since 2+2 is 4, that leaves 1 remaining.
16th Jun 2017, 8:23 AM
Leon D
Leon D - avatar
0
a%b gives you the remainder of a divided by b. https://en.wikipedia.org/wiki/Remainder#Integer_division
16th Jun 2017, 8:20 AM
Bogdan Sass
Bogdan Sass - avatar
0
remember how you used to divide in elementary school? well the modulo is about the remainder of a division
16th Jun 2017, 1:36 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
0
Thanks. I figured it out
16th Jun 2017, 3:15 PM
Dánjal Eliassen
Dánjal Eliassen - avatar