0

Go coding help needed with this problem

Hello community. I would like your help regarding this task from SoloLearn. I really dont know how to take an input and output the corresponding Number name as String. Example: input (2) and get Two output. Thanks for the help You are making a robot that can speak numbers. Your robot should take 3 numbers in the range of 0-10 as input and output the corresponding texts in English. Sample Input: 8 0 5 Sample Output: Eight Zero Five

31st Dec 2021, 5:30 PM
Lazaro Carrillo
Lazaro Carrillo - avatar
2 Antworten
0
you can use a for loop to get three inputs. var n int for i:=0; i < 3 ; i++{ fmt.Scanln(&n) your conditions to output strings use if or switch }
31st Dec 2021, 5:44 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
Puedes utilizar switch y en los case 1 : System.out.println("uno"); O poner un array con los números en letras ["uno","dos","tres","cuatro",...] y restarle uno al número del Scanner, porque las posiciones de los arrays empiezan por cero.
1st Jan 2022, 12:56 AM
Javier Garcia