When we write 1234 to one two three four then we need to first get 1 followed by 2 and so on. Once we get that its easy we can replace the text as follows -
int main()
{
int n = 1234;
char word[][10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
// first reversing the number to output from front
int reverse = 0;
while (n != 0)
{
reverse = reverse * 10;
reverse = reverse + n%10;
n = n/10;
}
// now outputting the word
while (reverse != 0)
{
printf("%s ", word[reverse % 10]);
reverse /= 10;
}
}