You’re not updating the value of b inside the loop, so its value is always 6. You need to use an assignment operator to actually set a new value.
So, use b = b + 3; or b += 3; instead.
1
solved Why is this while loop an infinite loop? High school introduction to CS exam review [closed]