Program for printing the last digit of an integer in words

0
55
#include<stdio.h>
#include<conio.h>
void main()
{
 long no;
 clrscr();
 printf("\n Enter an integer\n");
 scanf("%ld",&no);
 switch(no%10)
 {
  case 0:
         printf("\n zero \n");
         break;
  case 1:
         printf("\n one \n");
         break;
  case 2:
         printf("\n two \n");
         break;
  case 3:
         printf("\n three \n");
         break;
  case 4:
         printf("\n four \n");
         break;
  case 5:
         printf("\n five \n");
         break;
  case 6:
         printf("\n six \n");
         break;
  case 7:
         printf("\n seven \n");
         break;
  case 8:
         printf("\n eight \n");
         break;
  case 9:
         printf("\n nine \n");
 }
getch();
}
 Output 1:
 Enter an integer
 3456
 six
 Output 2:
 Enter an integer
 123
 three

 

 

 

Program for printing the last digit of an integer in words Program for printing the last digit of an integer in words in c A Program for printing the last digit of an integer in words Program for printing the last digit of an integer in words using switch case switch case program in c switch case switch case example

LEAVE A REPLY

Please enter your comment!
Please enter your name here