To convert the given number (1 to 10) to characters
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter a number <1 to 10> : ");
scanf("%d", &n);
switch(n)
{
case 1 :
printf("\nONE");
break;
case 2 :
printf("\nTWO");
break;
case 3 :
printf("\nTHREE");
break;
case 4 :
printf("\nFOUR");
break;
case 5 :
printf("\nFIVE");
break;
case 6 :
printf("\nSIX");
break;
case 7 :
printf("\nSEVEN");
break;
case 8 :
printf("\nEIGHT");
break;
case 9 :
printf("\nNINE");
break;
case 10 :
printf("\nTEN");
break;
default :
printf("\nInvalid Input.");
}
getch() ;
}
Output:
Enter a number <1 to 10> : 7
SEVEN
-
UpdatedDec 30, 2019
-
Views5,253
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order