+ 1

JAVA Simple Calculator remove decimal places

Can anyone teach me how to remove decimal places if the answer is a whole number?

28th Sep 2019, 1:01 PM
Joseph Brendon Jon I. Loremia
Joseph Brendon Jon I. Loremia - avatar
4 odpowiedzi
+ 1
FOLLOW ME You can convert the double value into a intvalue. int x = (int) y where y is your double variable. Then, printing x does not give decimal places (15000 instead of 15000.0).
28th Sep 2019, 1:10 PM
KfirWe
KfirWe - avatar
+ 1
ill try . thanks for your help ❤️
28th Sep 2019, 1:11 PM
Joseph Brendon Jon I. Loremia
Joseph Brendon Jon I. Loremia - avatar
0
great . thanks for your help
28th Sep 2019, 2:35 PM
Joseph Brendon Jon I. Loremia
Joseph Brendon Jon I. Loremia - avatar