+ 1
Please help me with one thing, can you please tell me how to make Kotlin always output a fraction?
I need to make sure that the output data must be of the Double type, even if the sum is a round number, please help. đđđ
6 Answers
+ 4
If you wish to force decimal points to 2, you can use: print("%.2d".format(sum.toDouble()))
+ 1
FigAzz
would you please post your question in English, So We can help you.
+ 1
Okay, l translating with interpreter
+ 1
print(sum.toDouble())
+ 1
Thank you very much đđđ
+ 1
If you wish to force decimal points to 2, you can use: print("%.2d".format(sum.toDouble()))
Thank you