Home > Software engineering >  How to convert numbers to letters in swift?
How to convert numbers to letters in swift?

Time:05-18

I'm stuck help. You have to use strings, but I haven't really found a logical way to make this work well.

var letters = ["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten"]

var str:String

  print("Enter a number from 0 to 10: ")
  str = readLine()!
  print (letters[0])
...

  print("Enter a number from 0 to 10: ")
  str = readLine()!
  print (letters[10])

CodePudding user response:

Maybe this api is similar but not exactly what you need. enter image description here

  • Related