C Program to Take Integer Input and Display Appropriate Alphabets using Switch Case

0
1
digitalample eye
Write a program to take input as a integer which will be the value of alphabets up to 26 alphabets and use switch case and display appropriate alphabets when user enters value  1 to 26.

C Code 

#include <stdio.h>
#include <conio.h>
void main()
{
int alphabets;

ABC:printf("nEnter the value of alphabets:");
scanf("%d",&alphabets);

printf("nThe alphabet is : ");
switch (alphabets){

case 1:
printf("A");
break;

case 2:
printf("B");
break;

case 3:
printf("C");
break;

case 4:
printf("D");
break;

case 5:
printf("E");
break;

case 6:
printf("F");
break;

case 7:
printf("G");
break;

case 8:
printf("H");
break;

case 9:
printf("I");
break;

case 10:
printf("J");
break;

case 11:
printf("K");
break;

case 12:
printf("L");
break;

case 13:
printf("M");
break;

case 14:
printf("N");
break;

case 15:
printf("O");
break;

case 16:
printf("P");
break;

case 17:
printf("Q");
break;

case 18:
printf("R");
break;

case 19:
printf("S");
break;

case 20:
printf("T");
break;

case 21:
printf("U");
break;

case 22:
printf("V");
break;

case 23:
printf("W");
break;

case 24:
printf("X");
break;

case 25:
printf("Y");
break;

case 26:
printf("Z");
break;

default:
printf("Not Found");
}

goto ABC;

getch();
}

Output

alphabets dictionary

LEAVE A REPLY

Please enter your comment!
Please enter your name here