void main()
{
char
n1[10][10]={"Zero","One","Two","Three","Four","Five","Six","Seven","Eigth","Nine"};
char
n2[10][10]={"Ten","Eleven","Tweleve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"};
char
n3[10][10]={"Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninty","Hundred"};
int
n;
printf("Enter
digit:");
scanf("%d",&n);
clrscr();
printf("%d
in words: ",n);
if(n>=0&&n<=100)
{
if(n<=9)
printf("%s",n1[n]);
else
if(n<=19)
printf("%s",n2[n%10]);
else
if(n%10==0)
printf("%s",n3[n/10-2]);
else
{
printf("%s
",n3[n/10-2]);
printf("%s",n1[n%10]);
}
}
else
{
clrscr();
printf("WRONG
INPUT!!");
getch();
exit(0);
}
getch();
clrscr();
}
No comments:
Post a Comment