80: Program to find the maximum between two numbers. Using the switch statement.
// Program to find the maximum between two numbers. Using the switch statement.
// ****************************************************************************************************************************
#include <iostream>
using namespace std;
int main()
{
float num1, num2;
cout << "Enter first number: ";
cin >> num1;
cout << "Enter second number: ";
cin >> num2;
switch (num1 > num2)
{
case 1:
cout << num1 << " is greater than " << num2;
break;
case 0:
cout << num2 << " is greater than " << num1;
break;
default:
cout << "Invalid Input";
break;
}
return 0;
}
Comments
Post a Comment