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); } }
2 odpowiedzi
+ 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
+ 1
Thanks