Last active
March 17, 2017 08:58
-
-
Save gpetuhov/48d9039c365ad20c68ffd4595d0eb1aa to your computer and use it in GitHub Desktop.
C++ Get maximum of two numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int getMax(int x, int y) | |
{ | |
if (x > y) | |
return x; | |
else | |
return y; | |
} | |
int main() { | |
int x, y = 0; | |
cout << "Enter X" << endl; | |
cin >> x; | |
cout << "Enter Y" << endl; | |
cin >> y; | |
cout << "MAX = " << getMax(x, y) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment