# Thread: converting numbers to words

1. ## Can find y this prog dont work properly?(plz)

none

2. Code:
```void TransformDigitsToLetters(int n,char str[])
{
/* take the first 2 digits (and save them as 14 */
char* test[2];
int digits;

/* "take first 2 digits", actually the last two digits: 11'14'*/
digits = n%100;

/* save them as fourteen */
if(digits != 0){
if(digits < 20);
test[0] = numbers[digits -1];
else {
test[1] = tens[digits/10 - 1];
if(digits%10 != 0)
test[0] = numbers[digits%10 - 1]
}
}```

3. Originally Posted by zuiplap
Code:
```void TransformDigitsToLetters(int n,char str[])
{
/* take the first 2 digits (and save them as 14 */
char* test[2];
int digits;

/* "take first 2 digits", actually the last two digits: 11'14'*/
digits = n%100;

/* save them as fourteen */
if(digits != 0){
if(digits < 20);
test[0] = numbers[digits -1];
else {
test[1] = tens[digits/10 - 1];
if(digits%10 != 0)
test[0] = numbers[digits%10 - 1]
}
}```
Aside from posting a function that doesn't compile, you forgot to explain what part of the problem you're trying to help with. Something as simple as "Here is a function which converts numbers less than 100 to words. Modifying it for larger numbers isn't that hard once you have this," would do nicely.