What do these code snippets print? a. int result = 0; for (int i = 1; i
Question:
What do these code snippets print?
a. int result = 0;
for (int i = 1; i <= 10; i++) { result = result + i; }
System.out.println(result);
b. int result = 1;
for (int i = 1; i <= 10; i++) { result = i - result; }
System.out.println(result);
c. int result = 1;
for (int i = 5; i > 0; i--) { result = result * i; }
System.out.println(result);
d. int result = 1;
for (int i = 1; i <= 10; i = i * 2) { result = result * i; }
System.out.println(result);
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: