Get detailed and accurate responses to your questions with IDNLearn.com. Our platform is designed to provide reliable and thorough answers to all your questions, no matter the topic.

What is the output for the following program?
numA = 4
while numA <12:
numA = numA + 3
print(numA)
Output:


Sagot :

Answer:

13

Explanation:

int numA = 4;

whilie (numA < 12){

  numA += 3;

}

System.out.print(numA);

numA          numA < 12

  4                   true ⇒ numA increases by 3, loop continues

  7                   true ⇒ numA increases by 3, loop continues

  10                 true ⇒ numA increases by 3, loop continues

  13                 false ⇒ loop stops, program them prints out value of numA