#include <iostream>
using namespace std;
void numWord(int,char[]); //Function Declaration

//Global Declaration Char Array With Pointer

char *one[]={” “,” one”,” two”,” three”,” four”,” five”,” six”,” seven”,

“eight”,” Nine”,” ten”,” eleven”,” twelve”,” thirteen”,” fourteen”,”fifteen”,” sixteen”,” seventeen”,” eighteen”,” nineteen”};

char *ten[]={” “,” “,” twenty”,” thirty”,” forty”,” fifty”,” sixty”,”seventy”,” eighty”,” ninety”};

void main()

{

int n;

clrscr();

printf(“Enter any number less than 1000: \t”);

scanf(“%d”,&n);

 

If(n>999)                             //Exits is n is more than 999.

printf(“–invalid.Enter a number less than 1000–\n”);

else if(n<=0)             //Exits If The Value Is Less Than Or Equal To “0”.

printf(“Enter numbers greater than 0\n”);

else if(n<100)            //Prints Two Digit Numbers.

numWord((n%100),”");

else if(n%100==0)        // To Print Hundred Multiples

numWord((n/100),”hundred”);

else

{

numWord((n/100),” hundred and”);

numWord((n%100),” “);

}

}

void numWord(int n,char ch[]) //Printing Function

{

(n>19)?printf(“%s %s \n”,ten[n/10],one[n%10]):printf(“%s “,one[n]);

printf(“%s “,ch);

}