‘C’ program to print digit into word

C File =>


/* Write ‘C’ program to accept a single digit and display it in words. For 
example, Input = 9 Output = Nine */

#include<stdio.h>
int main() 
{
      int n;
      printf("\n Enter single digit number : ");
      scanf("%d",&n);

      switch(n)
     {
           case 0:printf("\n Zero");
           break;
           case 1:printf("\n One");
           break;
           case 3:printf("\n Three");
           break;
           case 4:printf("\n Four");
           break;
           case 5:printf("\n Five");
           break;
           case 6:printf("\n Six");
           break;
           case 7:printf("\n Seven");
           break;
           case 8:printf("\n Eight");
           break;
           case 9:printf("\n Nine");
           break;
          default:printf("\n Invalid input");
        }
    return 0;
}

Comments

Popular posts from this blog

Write a program to allocate memory dynamically for n integers. Accept the elements and calculate their sum and average

C program to accept names of n cities and search for city named “Pune”.