Idea is: one[] = {"", "one", "two", ..............., "nine","ten", ........"nineteen"}; tens[] = {"", "", "twenty", "thirty",......"ninety"}; and store hundred[], thousand[] etc then check that how many digits are there, if the given number is a single digit then print: one[n] if the given number is having two digits then do : if(n>19) print(ten[n/10] , one[n%10]); else print(one[n]); if the given number is having three digits then do: print(one[n]); printf("hundred"); p = n / 10; printf(ten[p%10], one[n%10]); ......like that..correct me if i am wrong
On Sep 15, 9:57 pm, Raj Jagvanshi <raj.jagvan...@gmail.com> wrote: > display a num in words > ex: 38 = thirty eight; > 4567 = four thousand five hundred sixty seven. > > give me algo > > Thanks > Raj -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.