Turn Desktop View Off
You are here:   HomeC Programming (Theory)Control Structures in CAdd numbers until a negative or zero is encountered
by Dinesh Thakur Category: Control Structures

 

 

#include<stdio.h>

void main()
{
int code;
printf("\n MAIN MENU ");
printf("\n1.For color Red ");
printf("\n2.For color Green ");
printf("\n3.For color White ");
printf("\n4.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");
}
getche();
}
 
OUTPUT:
 
MAIN MENU
1. For color Red
2. For color Green
3. For color White
4. For color Yellow
Enter the color code: 2
color is GREEN


Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Popular Article