这个题怎么说呢,太简单了,实在没什么好说的!#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d", &n);
char* a[30] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
char* b[15] = {"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
if( n < 20)
printf("%s\n", a[n]);
else
{
if(n % 10 == 0)
printf("%s\n",b[(n/10) - 2]);
else
printf("%s-%s\n",b[(n/10) - 2], a[n%10]);
}
return 0;
}
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
Input
6
Output
six
Input
99
Output
ninety-nine
Input
20
Output
twenty
Hint
You can find all you need to know about English numerals in http://en.wikipedia.org/wiki/English_numerals .
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d", &n);
char* a[30] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
char* b[15] = {"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
if( n < 20)
printf("%s\n", a[n]);
else
{
if(n % 10 == 0)
printf("%s\n",b[(n/10) - 2]);
else
printf("%s-%s\n",b[(n/10) - 2], a[n%10]);
}
return 0;
}
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
6
six
99
ninety-nine
20
twenty
Hint
You can find all you need to know about English numerals in http://en.wikipedia.org/wiki/English_numerals .