#include<stdio.h>
#include<conio.h>
char one[20][10]= {"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Ninteen"};
char tens[10][10]={"","","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninty"};
void display(int n)
{
int r;
if(n<20)
printf(" %s ",one[n]);
else
{
r=n%10;
n=n/10;
printf(" %s %s ",tens[n],one[r]);
}
}
void main()
{
long n,m;
int a[5];
int c=0;
clrscr();
printf("Enter number : ");
scanf("%ld",&n);
m=n;
while (n>0)
{
if (c==1)
{
a[c]=n%10;
n=n/10;
}
else
{
a[c]=n%100;
n/=100;
}
c++;
}
c--;
if (m>=10000000L)
{
display (a[c]);printf("Crore");c--;
if (a[c]>0)
{
display (a[c]);printf("Lack");
}c--;
if (a[c]>0)
{
display(a[c]);printf("Thousand");
}c--;
if (a[c]>0)
{
display(a[c]);printf("Hundred");
}c--;
if (a[c]>0)
display(a[c]);
}
else if(m>=100000L)
{
display (a[c]);printf("Lack");c--;
if (a[c]>0)
{
display(a[c]);printf("Thousand");
}c--;
if (a[c]>0)
{
display(a[c]);printf("Hundred");
}c--;
if (a[c]>0)
display(a[c]);
}
else if(m>=1000)
{
display(a[c]);printf("Thousand");c--;
if (a[c]>0)
{
display(a[c]);printf("Hundred");
}c--;
if (a[c]>0)
display(a[c]);
}
else if(m>=100)
{
display (a[c]);printf("Hundred");c--;
if (a[c]>0)
display(a[c]);
}
else
display(a[c]);
getch();
}
#include<conio.h>
char one[20][10]= {"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Ninteen"};
char tens[10][10]={"","","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninty"};
void display(int n)
{
int r;
if(n<20)
printf(" %s ",one[n]);
else
{
r=n%10;
n=n/10;
printf(" %s %s ",tens[n],one[r]);
}
}
void main()
{
long n,m;
int a[5];
int c=0;
clrscr();
printf("Enter number : ");
scanf("%ld",&n);
m=n;
while (n>0)
{
if (c==1)
{
a[c]=n%10;
n=n/10;
}
else
{
a[c]=n%100;
n/=100;
}
c++;
}
c--;
if (m>=10000000L)
{
display (a[c]);printf("Crore");c--;
if (a[c]>0)
{
display (a[c]);printf("Lack");
}c--;
if (a[c]>0)
{
display(a[c]);printf("Thousand");
}c--;
if (a[c]>0)
{
display(a[c]);printf("Hundred");
}c--;
if (a[c]>0)
display(a[c]);
}
else if(m>=100000L)
{
display (a[c]);printf("Lack");c--;
if (a[c]>0)
{
display(a[c]);printf("Thousand");
}c--;
if (a[c]>0)
{
display(a[c]);printf("Hundred");
}c--;
if (a[c]>0)
display(a[c]);
}
else if(m>=1000)
{
display(a[c]);printf("Thousand");c--;
if (a[c]>0)
{
display(a[c]);printf("Hundred");
}c--;
if (a[c]>0)
display(a[c]);
}
else if(m>=100)
{
display (a[c]);printf("Hundred");c--;
if (a[c]>0)
display(a[c]);
}
else
display(a[c]);
getch();
}
No comments:
Post a Comment