Program for Number to string conversion in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Program for Number to string conversion in java

ex: 121 it has to print one hundred and twenty one

28th Mar 2017, 4:32 AM
Hemanth Sans
Hemanth Sans - avatar
4 Answers
+ 13
Look at the code playground, there are some examples for this.
28th Mar 2017, 4:40 AM
Tashi N
Tashi N - avatar
+ 2
Use String.format() function Example float number = 95.564f; System.out.println(String.format ("%.1f", number)); System.out.println(String.format ("%.2f", number)); System.out.println(String.format ("%.4f", number)); Output 95.6 95.56 95.5640
28th Mar 2017, 4:49 AM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar
+ 2
Sorry my fault, haven't seen the description.
28th Mar 2017, 4:55 AM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar
+ 1
thanks for your advice guys..
28th Mar 2017, 4:57 AM
Hemanth Sans
Hemanth Sans - avatar