Wednesday, August 21, 2013

Write a program in c to read an integer and display each of the integer in English


/*------------------------------------------------------------------------------------------------
Program    : Write a program in c to read an integer and display each of the
                      integer in English.
Created By: JABIR DAUD PATHAN
Branch       : COMPUTER ENGINEERING
-------------------------------------------------------------------------------------------------*/

#include<stdio.h>
#include<conio.h>

void main()
 {
  int no,rem1,rem2,rev=0;
  clrscr(); 

 accept:        
            printf("Enter Any number which is less than 32767==>");
            scanf("%d",&no);

            if(no>=32767)
             goto accept; 

 while(no>0)
   {
     rem1=no%10;
     rev=rev*10+rem1;
     no=no/10;
   }
   while(rev>0)
    {
      rem2=rev%10;
      rev=rev/10;
      switch(rem2)
       {
              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;

             case 10:
                           printf("Ten");
                           break;

             default:
                           printf("Number is not found");
                           break;
     }
    }
   getch(); 
 }





/*-----------------<< OUTPUT SCREEN  >>-------------------*/


Enter Any number==>1234
            One     Two     Three   Four

No comments:

Post a Comment