Question: I need someone help with very basic stuff! Please have explaination too! int b=5; int ans=0; while (b <11){ b=b+2; ans=ans+b; } System. out .println(ans);

I need someone help with very basic stuff! Please have explaination too!

int b=5;

int ans=0;

while (b<11){

b=b+2;

ans=ans+b;

}

System.out.println(ans);

question 1: How many times the body of the while loops is executed?

question 2: What are the values of 'b' and 'ans' at the end of each loop iteration.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!