Print word for number
/*
Print word for number
eg 5 - five
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int rev,n,d;
rev=0;
clrscr();
printf("enter the number");
scanf("%d",&n);
while(n!=0)
{
d=n%10;
rev=(rev*10)+d;
n=n/10;
}
n=rev;
while(n!=0)
{
d=n%10;
switch(d)
{
case 0:printf("zero");break;
case 1:printf("one");break;
case 2:printf("two");break;
case 3:printf("three");break;
case 4:printf("four");break;
case 5:printf("five");break;
case 6:printf("six");break;
case 7:printf("seven");break;
case 8:printf("eight");break;
case 9:printf("nine");break;
}
n=n/10;
}
getch();
}
/*
output :-
------------
enter the number5
five
*/
Print word for number
eg 5 - five
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int rev,n,d;
rev=0;
clrscr();
printf("enter the number");
scanf("%d",&n);
while(n!=0)
{
d=n%10;
rev=(rev*10)+d;
n=n/10;
}
n=rev;
while(n!=0)
{
d=n%10;
switch(d)
{
case 0:printf("zero");break;
case 1:printf("one");break;
case 2:printf("two");break;
case 3:printf("three");break;
case 4:printf("four");break;
case 5:printf("five");break;
case 6:printf("six");break;
case 7:printf("seven");break;
case 8:printf("eight");break;
case 9:printf("nine");break;
}
n=n/10;
}
getch();
}
/*
output :-
------------
enter the number5
five
*/
cn u splain d program especialaly Logic..thnxx in advnce.
ReplyDelete