0
How can u take input in int and covert into string
Example User input =1 Output =One I am getting a lot of errors plz help me https://code.sololearn.com/c46fMWEb7WqF/?ref=app
4 Réponses
+ 3
This code coach intends for you to use a loop to take the input 3 times. Then use a switch to check for the numbers 0-10 inclusive. You can set a string value to the corresponding number word ("Zero", "One", "Two", etc). Then output the correct number word for each input.
+ 2
Vishal Rathod you can loop over the switch 3 times also and take input inside the loop
+ 1
🅰🅹 🅐🅝🅐🅝🅣
Thank you
0
Vishal Rathod
Hint-
Make a function with parameter and write switch case there and call that function 3 times with different parameter like this:
func convertToWord(num int) {
switch {
num == 1:
fmt.Println("One");
num == 2:
fmt.Println("Two");
.......
.........
And so on.
}
}
Call this function 3 times in main function after taking user input like this:
func main() {
convertToWord(a);
convertToWord(b);
convertToWord(c);
}