+ 3
Challenge question_Java
What is the output of this code? int a = 9%5%5; System.out.println(a); The supposed answer is "4". Could anyone explain me why? Actually, 9%5 = 4; then, 4%5=0? Or am I wrong?
5 ответов
+ 2
9%5=4
4%5=4
when 4 is divided by 5, the remainder is 4
+ 4
thankyou for your answer! So if we try to use % with a smaller and a bigger number, the output will be a smaller number, right?
for example, 10%15=10?
+ 3
@Iskender, yes. exactly.
+ 3
@Iskender, You are welcome
+ 2
thankyou! You really helped me out ☺