# Thread: count the letters in each number between 1 and 1000 inclusive

1. does everyone agree that if i check the numbers 1 to 19 inclusive and they are right, and i check the numbers 10 to 90 inclusive and they are rright there is no point in checking 21 for ecample as it cant be wrong as 1 and 20 are correct.

2. I suspect you won't like this answer, but 40 is spelt "forty".

I get 21124 with the correct spelling.

Ironically, your original numeric case statement had the right number of characters.

3. I didn't skim the codes, but you have to account for the hundreds and above, when the magnitude is greater than 1 too:

100 = one hundred
200 = two hundreds

1000 = one thousand
2000 = two thousands

1000000 = one million
2000000 = two millions

And there is the conjunction "and". Example: 2345 = two thousands, three hundreds and forty five.

This "and" can happen more than once. Example: 123456: one handred and twenty three thousands, four hundreds and fifty six.

There is another complexity to add to the mix: Take 1123 and 1023 as examples:

1123 = one thousand, one hundred and twenty three.
1023 = one thousand and twenty three (no commas!)...

4. yep i just checked that what an idiot lol i was just about to type it allows me to type forty here with out correcting it then realised i had misspelt it in the array

5. @ flp if you wrote down the number 312 in words you would say three hundred and twelve. there would be no plural for the hundred.

6. Originally Posted by cooper1200
@ flp if you wrote down the number 312 in words you would say three hundred and twelve. there would be no plural for the hundred.
This is the coloquial way. In the formal way there is more then ONE hundred in 300, there is 3 hundreds, plural...
Even if one accepts the coloquial way for hundreds, what about thousands, millions, billions and above?

7. ok now this has annoyed me.... i just uncommented the switch statements and it worked!! i haven't changed any of the code all i have done is reorder things in count letters so it prints the words in the right order.

8. flp i except your point but the exercise was for singular hundreds.

9. Originally Posted by cooper1200
flp i except your point but the exercise was for singular hundreds.
Ok... coloquial way it is... so thousands, millions and so forth follow the same rule, right?

What about the "and"s? They NEED to be counted as well...

10. > And there is the conjunction "and". Example: 2345 = two thousands, three hundreds and forty five.
> This "and" can happen more than once. Example: 123456: one handred and twenty three thousands, four hundreds and fifty six.
coop has it right, they are singular when spelling out numbers as words.

11. Originally Posted by Salem
> And there is the conjunction "and". Example: 2345 = two thousands, three hundreds and forty five.
> This "and" can happen more than once. Example: 123456: one handred and twenty three thousands, four hundreds and fifty six.
coop has it right, they are singular when spelling out numbers as words.
Ok... Even when there are no sub units? For exemple: 2000 = two thousand or two thousands? Which one is wrong?

Notice, I'm not qualifying the numbers as in "two thousand dollars"...

12. if i was counting somthing i might say i counted in thousands or i counted in hundreds or if someone asked me how much something cost for example. If it was a lot of money i was a little embarrassed about it i might say it cost hundreds. project euler though said to count the word and and not the spaces. and gave an example of three hundred and forty two having 23 letters. so i followed that format.

13. > Notice, I'm not qualifying the numbers as in "two thousand dollars"...
The plural goes to the subject.

You don't say "two thousands dollar" for example.

14. Originally Posted by Salem
The plural goes to the subject.
You don't say "two thousands dollar" for example.
Yep... I've got this hence I told not applying "qualifiers" or objects to the spelling.
One can argue that since quantities greater than a unit are already expressing more then 1 thing, it doen't make sense to use plurals on "hundred", "thousand" and so forth... But I think this is the coloquial way only, isn't it? If the rule is to NEVER use plural to these groupings, then sentences as "I have hundreds of dollars in my pocket" (poket is the object, singular!) or "they were killed by the millions" (They, as the "subject" already express plural!) makes no sense...

"Oh... but in these examples you are expressing a notion of magnitude only!". The same way one's do when using "thousand", "hundred", etc...

Well... Quirks of any language, I guess...

What about the other issue? The usage of "and"? You could substitute "and"s by commas, as in: 1023 "one throusand and twenty three" by "one thousand, twenty three" or 1123 "one thousand, one hundred [and or ,] twenty three"...

15. It's commas all the way, except for the final and.
Eg
Twenty two million, three hundred and forty thousand, nine hundred and seventy six.