Print numbers from entered number to nine in words

C program to read single digit number and print all numbers from that number to nine in words.

Solution:

In this program, read a single digit number from the user as an input. Print all numbers from entered number to nine in words.

Here, after case nine break statement is mandatory. Because, if we do not write break then statement under default is also executed.

#include<stdio.h>
int main()
{
     int n;
     printf("Enter Single Digit Number : ");
     scanf("%d",&n);
     printf("-------------------------------\n");
     switch(n)
     {
          case 0:
               printf("\tZERO\n");
          case 1:
               printf("\tONE\n");
          case 2:
               printf("\tTWO\n");
          case 3:
               printf("\tTHREE\n");
          case 4:
               printf("\tFOUR\n");
          case 5:
               printf("\tFIVE\n");
          case 6:
               printf("\tSIX\n");
          case 7:
               printf("\tSEVEN\n");
          case 8:
               printf("\tEIGHT\n");
          case 9:
               printf("\tNINE\n");
               break;
          default:
               printf("Not a Single Digit Number");
     }
     return 0;
}


Output:

number to nine in words