Day5-Break-Continue-String Intro
Day5-Break-Continue-String Intro
1. Loop recaps
int n = 4; A. 4
int x = 0;
while(n > 0) {
B. 6
for(int i = 0; i < n; ++i) { C. 7
++x; D. 8
} E. This will cause a compile error
n /= 2;
}
//value of x?
1
CSE 11 – Intro to Programming, Expedited Week 2 - Monday
for (int i = 0; i < 10; i++){ How many times is continue statement
if (i++%3==0) { executed?
continue;
}
A. 0
if (--i%2==0){ B. 1
break; C. 2
} D. 5
System.out.println(i); E. 10
}