Java Program Need Know Solve Hand Using Computer Program Public Class Javaapplicationguess Q37109718

this is in java program, I need to know how can I solve this inhand with out using computer program.  

public class JavaApplicationGuess {
public static void main(String[] args) {
int i = 0;
int x = 0;
  
for (i =3; i > 1; i–) {
do {
x = x * 2 + 3;
System.out.println(x);
} while (x < 8);
x = x -1 + i;
System.out.println(i + ” ” + x);
}
}
}

my output doing in hand are

3

9

21 which is wrong

2 22 wrong


Solution


ANSWER:-

initial value of i=0 and x=0

first exicute for loop and initialize i=3 then check condition ,condition is true so exicute body of for loop and exicute do-

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.