#include <iostream>
using namespace std;
int main()
{
int num1=10, num2=20;
if(num1 < num2)
{
cout<<"Num2 is greater";
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int num1=10, num2=20;
if(num1 > num2)
{
cout<<"Num2 is greater";
}
else
cout<<"Num1 is smaller";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int num1=20, num2=10;
if(num1 > num2)
{
cout<<"Num2 is greater";
}
else if (num1 < num2)
{
cout<<"Num1 is smaller";
}
else
{
cout<<"Num1 and Num2 are equal";
}
return 0;
}
switch (Expression)
{
case condition1:
//Statements;
break;
case condition2:
//Statements;
break;
case condition3:
//Statements;
break;
.
.
case condition n;
//Statements;
break;
default:
//Statement;
}
#include <iostream>
using namespace std;
int main()
{
char color='O';
switch(color)
{
case 'R': cout<<"Red"<<endl;
break;
case 'G': cout<<"Green"<<endl;
break;
case 'B': cout<<"Blue"<<endl;
break;
case 'O': cout<<"Orange"<<endl;
break;
case 'P': cout<<"Pink"<<endl;
break;
case 'W': cout<<"White"<<endl;
break;
case 'Y' : cout<<"Yellow"<<endl;
break;
default: cout<<"Inavlid Color"<<endl;
}
return 0;
}