Number of characters in an integer's name The goal of this challenge is to show how many characters are in the name of a given integer. This is code golf, so the smallest code wins.

RULES


The input will be between 0 and 100 (inclusive). If it is not the program won't return anything.
The result has to be printed as input : answer
Result for 100 is hundred


For example, if the input is 23 you have to count the numbers of letters twenty-three : here the answer is 12, and you should print 23 : 12
C : 117 bytes

(From kind suggestion of @edc65 and @ColeCameron)



f(a){char *d="0446554665366887798803665557667";printf("%d : %d",a,(a?a&lt;20?d[a]-(a&lt;10):d[a%10]+d[20+a/10]-48:52)-48);}


Live example

C++ : 159 bytes 178 bytes



int f(int a){char *d[3]={"0446554665","0366555766","3668877988"};printf("%d : %d",a,(a?a&lt;20?a&gt;9?d[2][a-10]:d[0][a]-1:a&gt;99?55:d[0][a%10]+d[1][a/10]-48:52)-48);}


Live example

Explanation

Explanation from previous code, with all suggestions from comments incorporated.



int f(int a) {  // Return int to save a byte, a is the argument

    int d[3][10]={
             {0,4,4,6,5,5,4,6,6,5},  // Length of "", "-one", "-two", "-three" etc.
             {0,3,6,6,5,5,5,7,6,6},  // Length of "", "ten", "twenty", etc.
             {3,6,6,8,8,7,7,9,8,8}   // Length of "ten", "eleven", etc.
           };
    printf ("%d : %d", a,
               a 
                 // If a is not zero
                 ? a &lt; 20
                     // If a is less than 20
                     ? a &gt; 9
                         // a is in range 10-19
                         ? d[2][a-10]
                         // a is in range 0-9
                         : d[0][a]-1  // Subtract one as '-' is not required
                     // If a is &gt;= 20
                     : a &gt; 99
                         // If a is 100
                         ? 7  // Length of hundred
                         // a is between 20-99
                         : d[0][a%10] + d[1][a/10]  // unit digit length + tens digit length
                 // If a is zero
                 : 4
            );
}