+ 2
Division in Java
Why when I tried to get the result of 5 / 2 I have 2 in output and not 2.5 ? https://code.sololearn.com/cXP63eq3zOMs/?ref=app
3 ответов
+ 5
you can use : 🤗🙆♂️ 💗
5.0 / 2
5/ 2.0
5.0 / 2.0
+ 3
Program is treating 5 and 2 as a int value and make a round to down. If you write this as a 5.0 and 2.0 will be 2.5 like double does :)
+ 1
Ok thanks dude