Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
void foo(int value);
int main(int argc, char *argv[])
{
char line[100];
int i, n1, n2, num;
char str1[100];
char str2[100];
printf("Please enter 1st number: ");
scanf("%s", str1);
printf("\nPlease enter 2nd number: ");
scanf("%s", str2);
printf("\nConcatenation of 1st & 2nd: %s\n", strcat(str1, str2));
getchar();
n1 = atoi( strcat(str1, str2) );
printf("\nOnly Digits of the Concatenation: %d\n", n1);
foo(n1);
putchar('\n');
system("PAUSE");
return 0;
}
void foo(int value)
{
static const char *digit[] =
{
"zero", "one", "two", "three", "four",
"five", "six", "seven", "eight", "nine",
};
if ( value > 0 )
{
foo(value / 10);
printf("%s ", digit [ value % 10 ] );
}
}
I almost have it, this doesnt covert fully if theres a word/letter in the n1 =/