C Program to Read a Number and Displaying Its Digit in Words in Reverse Order

#include
#include

int main()
{
	 long int number, rem;
	 clrscr();
	 printf("Enter number: ");
	 scanf("%ld", &number);
	
	 /* Printing Each digits in words */
	 while(number != 0)
	 {
		  rem = number%10;
		
		  switch(rem)
		  {
			   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;
		  }
		
		  number = number/10;
	 }
	 getch();
	 return(0);
}

Output 

Run 1:
------------
Enter number: 67395 ↲ 
Five Nine Three Seven Six

Run 2:
------------
Enter number: 13125 ↲  
Five Two One Three One

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.