0

Why the outcome is 20 how is that?

public class Program { public static void main(String[] args) { int number = 0; for(int i =1; i <=5; i++) { number = number + 4; } System.out.println (number); } }

28th Dec 2021, 3:30 PM
Loo Student
2 Respuestas
+ 3
Loop runs 5 times and it add 4 to number each time so number= 4+4+4+4+4=20 (5*4=20) It simple if you understand how loop work! Did you complete lesson of loop? if not, do it nw
28th Dec 2021, 3:35 PM
Jayakrishna 🇮🇳
+ 1
Thanks
28th Dec 2021, 3:46 PM
Loo Student