0

Hello,

if i want the computer to guess a number between 1 - 100

i'll do in java

```
int min = 1;
int max = 100;
```

I have already create a random number for the computer.

so the first random number the computer will choose is 49

as

```
in cGuess
cGuess = max - min / 2
----
cGuess = 100 - 1 / 2 = 49
```

what I want here is how I make the computer choose max = 49 not 100, if the guessed number was wrong.

and every time will take the new cGuess as max number until it guess the random number.

I think there is loop for it, but I tried everything but i couldn't solve it.

please help

thanks.