0

Java

If the user gives us a numer like 5 how does it complies to a word " five"

27th Jan 2019, 10:58 PM
Altina
Altina - avatar
4 Answers
+ 1
You can use a String array: String[] word = {"one", "two", ... , "nine"}; int number = 5; System.out.println (word [number -1]; //array index starts at 0 Output: five
27th Jan 2019, 11:20 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
You could use a simple switch statement... https://code.sololearn.com/cjekXqKw5gEN/?ref=app
28th Jan 2019, 4:09 AM
LordHill
LordHill - avatar
+ 1
Denise thankyou for your help dear!!
27th Jan 2019, 11:35 PM
Altina
Altina - avatar
+ 1
28th Jan 2019, 9:29 AM
Altina
Altina - avatar