x will obviously be between 5 and 6. You say, "nearest whole number". That might not be too accurate.
5^2=25;
6^2=36;
The better choice among the two of those is 5.
Why to the nearest whole number instead of maybe to the nearest tenth? ; , not too bad, and it's better than just 5.
- ; , only a little worse than 5.5.
What you might want is some value between 5.25 and 5.5.
You can continue and take a value as near as you want to give approach.