+ 1

How Can I remove decimal in Java Calculator?

Already solved thanks :)

15th Nov 2022, 3:42 PM
Clairo
Clairo - avatar
4 Answers
+ 2
You don‘t want have decimal places in the result then why do you took the double input. You could read integer numbers, just from the beginning. Otherwise you can convert the double to integer number.
15th Nov 2022, 3:52 PM
JaScript
JaScript - avatar
+ 1
Whats the code if Im gonna convert the double to integer number?
15th Nov 2022, 4:04 PM
Clairo
Clairo - avatar
+ 1
Nicee I already solved my problem thanks to you @JaScript ^^
15th Nov 2022, 4:12 PM
Clairo
Clairo - avatar
+ 1
For this conversion are more ways, ie such as: Using TypeCasting: (int)mydouble; Using Double.intValue() method: Double mynewdouble = new Double(mydouble); mynewdouble.intValue(); Using Math.round() method: (int)Math.round(mydouble);
15th Nov 2022, 10:12 PM
JaScript
JaScript - avatar