Program to check whether the number is 1, 2 or 3 using switch statement - C++ Programming
Program:
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter the value of n" << endl;
cin >> n;
switch (n)
{
case 1:
cout << "Number is One" << endl;
break;
case 2:
cout << "Number is Two" << endl;
break;
case 3:
cout << "Number is Three" << endl;
break;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter the value of n" << endl;
cin >> n;
switch (n)
{
case 1:
cout << "Number is One" << endl;
break;
case 2:
cout << "Number is Two" << endl;
break;
case 3:
cout << "Number is Three" << endl;
break;
}
return 0;
}
Comments
Post a Comment