//Program to demonstarte the use of Switch case.
#include<stdio.h>
#include<conio.h>
void main()
{
int code;
clrscr();
printf("main menu");
printf("\n 1 for color red");
printf("\n 2 for color green");
printf("\n 3 for color white");
printf("\n 4 for color yellow");
printf("\n enter the color code");
scanf("%d",&code);
switch(code)
{
case 1:
printf("\n color is red");
break;
case 2:
printf("\n color is green");
break;
case 3:
printf("\n color is white");
break;
case 4:
printf("\n color is yellow");
break;
default:
printf("\n color does not found");
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int code;
clrscr();
printf("main menu");
printf("\n 1 for color red");
printf("\n 2 for color green");
printf("\n 3 for color white");
printf("\n 4 for color yellow");
printf("\n enter the color code");
scanf("%d",&code);
switch(code)
{
case 1:
printf("\n color is red");
break;
case 2:
printf("\n color is green");
break;
case 3:
printf("\n color is white");
break;
case 4:
printf("\n color is yellow");
break;
default:
printf("\n color does not found");
}
getch();
}