P
Q. What is the output of the following code?
Code:
int[] nums = {1, 2, 3, 4, 5};
for (int i = 0; i < nums.length; i += 2) {
System.out.print(nums[i] + ” “);
}
for (int i = 0; i < nums.length; i += 2) {
System.out.print(nums[i] + ” “);
}
- Correct Answer - Option(C)
- Views: 133
- Filed under category JAVA
Discusssion
Login to discuss.