C Program to convert digit into word


This is a C Program to convert digit into word using switch cases.

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    
/** C Program to convert digit into word using switch by SlashMyCode.com **/
   int d;
   clrscr();
   printf("Enter a Digit(0 to 9): ");
   scanf("%d",&d);
   switch(d)
   {
case 0:
      printf("Zero\n");
      break;

case 1:
      printf("one\n");
      break;
case 2:
      printf("Two\n");
      break;
case 3:
      printf("Three\n");
      break;
case 4:
      printf("Four\n");
      break;
case 5:
      printf("Five\n");
      break;
case 6:
      printf("Six\n");
      break;
case 7:
      printf("Seven\n");
      break;
case 8:
      printf("Eight\n");
      break;
case 9:
      printf("Nine\n");
      break;
default:
      printf("you entered invalid digit\n");
      break;
      }
/** C Program to convert digit into word using switch by SlashMyCode.com **/
   getch();

}

Output:


Flowchart:




No comments:

Post a Comment

Feel free to ask us any question regarding this post