Write a C++ program to find the maximum between two numbers. Using the switch statement.
Flowchart of the program to find the maximum between two numbers with the help of switch statement
C++ source code to show the maximum number between two numbers by using the switch statement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include<iostream> using namespace std; int main() { int n1,n2; cout<<"enter n1"<<endl; cin>>n1; cout<<"enter n2"<<endl; cin>>n2; switch(n1>n2) { case 0: cout<<n1<<"is not greater"<<endl; break; case 1: cout<<n1<<"is greater"<<endl; break; default: cout<<"invalid"<<endl; } } |
SFT (Shamil’s Flow Table )
Are you interested to Read about SFT(Shamil’s Flow Table)?