Salida de codigo/output code | Sololearn: Learn to code for FREE!
0

Salida de codigo/output code

print(1+2+3+4%5) #because is it print 10? #¿porque se imprime 10 en el resultado?

15th Apr 2017, 9:28 AM
Javi Gonzalez
Javi Gonzalez - avatar
3 Answers
+ 1
Hola Javi, como se dice "operator precedence" en Espanol? ¿Es "precedencia del operadores"? The modulo operator % has a higher rank than the plus signs. 4%5 is evaluated first and gives 4. The rest is just a simple addition from left to right.
15th Apr 2017, 9:46 AM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar
+ 1
thanks klaus in spanish "operador precedente" = "prioridad de operador" or "% tiene prioridad"
15th Apr 2017, 11:54 AM
Javi Gonzalez
Javi Gonzalez - avatar
- 1
10
15th Apr 2017, 9:41 AM
Calviղ
Calviղ - avatar