output : int a=5;
for(int i=1;i<3;i++)
{
a=a+i;
System.out.print(a);
}
Answers
Answered by
0
ANSWER.
- Output for the question is - 68
EXPLANATION.
The initial value of a is 5.
The for loop iterates 2 times.
When i = 1,
→ a = a + i
→ a = 5 + 1
→ a = 6
> a is printed.
When i = 2,
→ a = a + i
→ a = 6 + 2
→ a = 8
> a is printed.
Now, the loop terminates as the condition given becomes false.
So, the final output is - 68
Similar questions