/* To Read a two digit number from KB and print a number in word*/
#include< stdio.h>
main()
{
	int n;
	clrscr();
	printf("enter value\n");
	scanf("%d",&n);
	two_digit(n);
	getch();
}
two_digit(int n)
{
	int x;
	if (n>0 && n<10)
	   single_digit(n);
	else
		if (n>10 && n<20)
			teen_digit(n);
		else
			if (n%10==0)
				ten_digit(n);
			else
			{
			    x=n%10;
			    n=n-x;
			    ten_digit(n);
			    single_digit(x);
			}
}
single_digit(int n)
{
	switch(n)
	{
		case 0: printf("zero");
			break;
		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;
		default:
			printf("The given number is not a single digit");
	}
}
ten_digit(int n)
{
	switch(n)
	{
		case 10: printf("ten");
			break;
		case 20: printf("twenty");
			break;
		case 30: printf("thirty");
			break;
		case 40: printf("fourty");
			break;
		case 50: printf("fifty");
			break;
		case 60: printf("sixty");
			break;
		case 70: printf("seventy");
			break;
		case 80: printf("eighty");
			break;
		case 90: printf("ninety");
			break;
		default:
			printf("The given number is not in 10,20,...");
	}
}
teen_digit(int n)
{
	switch(n)
	{
		case 11: printf("eleven");
			break;
		case 12: printf("twelve");
			break;
		case 13: printf("thirteen");
			break;
		case 14: printf("fourteen");
			break;
		case 15: printf("fifteen");
			break;
		case 16: printf("sixteen");
			break;
		case 17: printf("seventeen");
			break;
		case 18: printf("eighteen");
			break;
		case 19: printf("nineteen");
			break;
		default:
			printf("The given number is not in 11,12,...19");
	}
}

/*
Exercise 1: To read a three digit number from KB and print in words
	 2. To read a four digit number from KB and print in words
*/