Created
February 24, 2018 22:58
-
-
Save Cin316/5b1cd6170c54585750fb2642402a7153 to your computer and use it in GitHub Desktop.
TechOlympics 2018 Code Golf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let t=Int(readLine()!)! | |
| let a=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","forteen","fifteen","sixteen","seventeen","eighteen","nineteen"] | |
| let b=["twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"] | |
| if (t<20){print(a[t])} else if(t<100){print(b[t/10-2]+" "+a[t%10])} else if(t<1000){ | |
| let p=(t%100)/10 | |
| if (p<2){print(a[t/100]+" hundred "+a[t%20])} else {print(a[t/100]+" hundred "+b[p-2]+" "+a[t%10])}} | |
| Befunge: | |
| &&+.@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment