Program to display the different colors using the switch statement.

#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter the value to display the colour\n\n1.Red\n2.Blue\n3.Green\n4.White\n5.Black"<<endl;
cout<<"Enter Your Choice:";
cin>>a;
switch(a)
{
case 1:
cout<<"Colour is Red\n";
break;
case 2:
cout<<"Colour is Blue\n";
break;
case 3:
cout<<"Colour is Green\n";
break;
case 4:
cout<<"Colour is White\n";
break;
case 5:
cout<<"Colour is Black\n";
break;
default:
cout<<"No Result\n";
}
cout<<"/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/";
}

Output:


Comments

Popular posts from this blog

To create an html page with frames and frameset

1. Write a program to insert a new element at end as well as at a given position in an array in Java

1. To familiarize with network devices like switch, hub, routers and bridges in LaTex