+ 1
why numbers that are present in this codes output=17 and 14 for( i=0;i<100;i++){if(i%10==i-10)document.write(i+ "");}
2 Respuestas
+ 1
A quick test in Code Playground shows that code yields number 10 to 19. The loop goes from 0 to 100, print the number ONLY if the remainder of number % 10 equals to number - 10.
(i = 10) 10 % 10 == 10 - 10 (0)
(i = 11) 11 % 10 == 11 - 10 (1)
(i = 12) 12 % 10 == 12 - 10 (2)
. . . . .
(i = 18) 18 % 10 == 18 - 10 (8)
(i = 19) 19 % 10 == 19 - 10 (9)
Hth, cmiiw
+ 1
https://code.sololearn.com/WYwBjNMNg5gN/?ref=app
I don't agree with you. When I run your code, I have the good output...