#include
#include
char tens[15][15]={{""},{""},{"Twenty "},{"Thirty "},{"Fourty "},{"Fifty
"},{"Sisty "},{"Seventy "},{"Eighty "},{"Ninty "}};
char one[25][15]={{""},{"One "},{"Two "},{"Three "},{"Four "},{"Five
"},{"Six "},{"Seven "},{"Eight "},{"Nine "},{"Ten "},{"Eleven "},{"Twelve
"},{"Thirteen "},{"Fourteen "},{"Fifteen "},{"Sisteen "},{"Seventeen
"},{"Eighteen "},{"Nineteen "}};
char out[150];
int n[10]={0},i,temp1=0,temp;
long int num,f;
void convert(int i)
{
if(i==7)
{
strcat(out,one[n[i]]);
strcat(out,"Crore ");
}
if(i==6||i==4||i==1)
{
if(n[i]==1)
temp1=n[i]*10;
if(i==1&&n[0]!=0&&f>1)
strcat(out," And ");
strcat(out,tens[n[i]]);
}
if((i==5||i==3||i==0||i==2))
{
if(temp1!=0)
{
temp1+=n[i];
if(i==0&&n[i+1]!=0&&n[i+2]==0&&f>1)
strcat(out," And ");
strcat(out,one[temp1]);
}
else
{
if(i==0&&n[i+1]!=0&&n[i+2]==0&&f>1)
strcat(out," And ");
strcat(out,one[n[i]]);
}
if(n[i]!=0||temp1!=0||n[i+1]!=0)
switch(i)
{
case 5:strcat(out,"Lakh ");break;
case 3:strcat(out,"Thousand ");break;
case 2:strcat(out,"Hundred ");
if(n[i]==0)
strcat(out," And ");
}
temp1=0;
}
}
void main()
{
int i=0,j;
char c[2];
clrscr();
c[1]='
No comments:
Post a Comment