Home › Forums › C Programming › help… › Reply To: help…
July 18, 2008 at 10:56 am
#3408
Humayan
Participant
Wow tedious! I would just use a series of conditional statements:
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | if ( number >= 1000 ) { switch ( number.firstDigit ) { case 1: { printf ( "one " ); }; break; case 2: { printf ( "two " ); }; break; case 3: { printf ( "three " ); }; }; printf ( "thousand ); } |
and so on for the “hundreds” position the “ty’s” ( twenty , thirty …. ) the teens ( 19 , 18 , 17 ….. ) and singles ( 9 , 8 , 7 ….. ) . Not a difficult program , just a pain to write ……..