Problem:Tavas and Nafas
Description:
Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.
His phone operating system is Tavdroid, and its keyboard doesn’t have any digits! He wants to share his score with Nafas via text, so he has no choice but to send this number using words.
He ate coffee mix without water again, so right now he’s really messed up and can’t think.
Your task is to help him by telling him what to type.
Input:
The first and only line of input contains an integer s (0 ≤ s ≤ 99), Tavas’s score
Output:
In the first and only line of output, print a single string consisting only from English lowercase letters and hyphens (’-’). Do not use spaces.
Sample Input 1:
6
Sample Output 1:
six
Sample Input 2:
99
Sample Output 2:
ninety-nine
Sample Input 3:
20
Sample Output 3:
twenty
Note:
You can find all you need to know about English numerals in http://en.wikipedia.org/wiki/English_numerals .
Language:C
#include <stdio.h>
char *array1[]={"zero","one","two","three","four","five","six","seven","eight","nine","ten",
"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};
char *array2[]={"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
int main()
{
int score;
scanf("%d",&score);
if(score<=20) printf("%s",array1[score]);
else
{
printf("%s",array2[score/10-2]);
if(score%10) printf("-%s",array1[score%10]);
}
return 0;
}