i have a problem with this code iv been try lots of expressions to show elven thousand to nineteen thousand and nothing seems to be can you guys help me out tnx in advance
#include<stdio.h>
int main()
{
int n,teens,thousands,hundreds,tens,ones,tthousands;
printf("Enter a number: ");
scanf("%d", &n);
tthousands=n/10000;
n=n%10000;
thousands=n/1000;
n=n%1000;
hundreds=n/100;
n=n%100;
if ((n>10) && (n<20))
{
tens=0;
ones=0;
teens=n%10;
}
else
{
tens=n/10;
n=n%10;
ones=n;
}
switch(tthousands)
{
case 1:printf("ten ");break;
case 2:printf("twenty ");break;
case 3:printf("thirty ");break;
case 4:printf("forty ");break;
case 5:printf("fifty ");break;
case 6:printf("sixty ");break;
case 7:printf("seventy ");break;
case 8:printf("eighty ");break;
case 9:printf("ninety ");break;
}
switch(thousands)
{
case 1: printf("One thousand "); break;
case 2: printf("Two thousand "); break;
case 3: printf("Three thousand "); break;
case 4: printf("Four thousand "); break;
case 5: printf("Five thousand "); break;
case 6: printf("Six thousand "); break;
case 7: printf("Seven thousand "); break;
case 8: printf("Eight thousand "); break;
case 9: printf("Nine thousand "); break;
}
switch(hundreds)
{
case 1: printf("one hundred "); break;
case 2: printf("two hundred "); break;
case 3: printf("three hundred "); break;
case 4: printf("four hundred "); break;
case 5: printf("five hundred "); break;
case 6: printf("six hundred "); break;
case 7: printf("seven hundred "); break;
case 8: printf("eight hundred "); break;
case 9: printf("nine hundred "); break;
}
switch(teens)
{
case 1:printf("eleven ");break;
case 2:printf("twelve ");break;
case 3:printf("thirteen ");break;
case 4:printf("fourteen ");break;
case 5:printf("fifteen ");break;
case 6:printf("sixteen ");break;
case 7:printf("seventeen ");break;
case 8:printf("eighteen ");break;
case 9:printf("nineteen ");break;
}
switch(tens)
{
case 1:printf("ten ");break;
case 2:printf("twenty ");break;
case 3:printf("thirty ");break;
case 4:printf("forty ");break;
case 5:printf("fifty ");break;
case 6:printf("sixty ");break;
case 7:printf("seventy ");break;
case 8:printf("eighty ");break;
case 9:printf("ninety ");break;
}
switch(ones)
{
case 1:printf("one ");break;
case 2:printf("two ");break;
case 3:printf("three ");break;
case 4:printf("four ");break;
case 5:printf("five ");break;
case 6:printf("six ");break;
case 7:printf("seven ");break;
case 8:printf("eight ");break;
case 9:printf("nine ");break;
}
getch();
return 0;
}