for(int a=6;a<=24;a=a+3)
{
if(a%4==0)
break;
}
System.out.println(a);
pls give the value of a after executed
Answers
Answered by
2
Answer:
12
Explanation:
The initial value of i is 6. The if statement is not executed as 6 is not divisible by 4. Now, the value of a is incremented by 3. Now, the value of a is 9. Again, the if statement is not executed. Now, the value of a is incremented by 3. Now, the value of a is 12 and the if block is executed as 12 is divisible by 4. The break statement is executed and the value of a is 12.
Similar questions