Question: Given the below snippet type the expected output. Hint: You don't need to go through each iteration, extract the logic/pattern that occurs to get the
Given the below snippet type the expected output.
Hint: You don't need to go through each iteration, extract the logic/pattern that occurs to get the answer.
public class Test{ public static void main(String []args){ int x = 0; for(int i = 0; i < 1000; i++){ x++; if(x / 2 == 0){ x--; } } System.out.println(x); } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
