#include <stdio.h>
#include <math.h>
#include <stdlib.h>

void main(int argc, char *argv[])

{
 int a, b, c, d;

 a = 1234;

 d = a % 10; a /= 10;
 c = a % 10; a /= 10;
 b = a % 10; a /= 10;
 a = a % 10;

if (a == 0);
 else
   {
    num (a);
    printf(" thousand ");
   }

 if ((b == 0) && (a == 0));
 else
   {
    num (b);
    printf(" hundred ");
   }

 if (((a != 0) || (b != 0)) && ((c != 0) || (d != 0)))
   printf("and ");

 if ((c == 0) && (b == 0) && (a == 0))
   {
    if (d == 0)
      printf("zero");
   }
 else if (c == 1)
   switch (d)
   {
    case 0: printf("ten");
	      break;
    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;
   }
 else
   switch (c)
   {
    case 0: 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;
   }

 if ((c != 0) && (d == 0));

 if ((c != 1) && (c != 0) && (d != 0))
   printf("-");

 if ((c != 1) && (d != 0))
   num (d);
}

num (x)
  int x;
  {
   char name[10];

   name[0] = "";
   name[1] = "one";
   name[2] = "two";
   name[3] = "three";
   name[4] = "four";
   name[5] = "five";
   name[6] = "six";
   name[7] = "seven";
   name[8] = "eight";
   name[9] = "nine";
   printf("%s", name[x]);
  }
