#include<stdio.h>
#include<conio.h>
void main()
{
int n,rev=0,num,rem;
clrscr();
printf("Enter any number::\n");
scanf("%d",&n);
num=n;
while(num>0)
{
rev=rev*10;
rev=rev+num%10;
num=num/10;
}
while(rev>0)
{
rem=rev%10;
rev=rev/10;
switch(rem)
{
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;
}
}
getch();
}
output :
Enter any number::
852
eight five two
#include<conio.h>
void main()
{
int n,rev=0,num,rem;
clrscr();
printf("Enter any number::\n");
scanf("%d",&n);
num=n;
while(num>0)
{
rev=rev*10;
rev=rev+num%10;
num=num/10;
}
while(rev>0)
{
rem=rev%10;
rev=rev/10;
switch(rem)
{
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;
}
}
getch();
}
output :
Enter any number::
852
eight five two
No comments:
Post a Comment