Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int firstNumber, secondNumber;
- cin >> firstNumber >> secondNumber;
- if (firstNumber > secondNumber) {
- cout << firstNumber << endl;
- }
- else {
- cout << secondNumber << endl;
- }
- return 0;
- }
- Решение с тернарен оператор:
- #include <iostream>
- using namespace std;
- int main() {
- int firstNumber, secondNumber;
- cin >> firstNumber >> secondNumber;
- cout << (firstNumber > secondNumber ? firstNumber : secondNumber) << endl;
- return 0;
- }
- Решение с max():
- #include <iostream>
- using namespace std;
- int main() {
- int firstNumber, secondNumber;
- cin >> firstNumber >> secondNumber;
- cout << max(firstNumber, secondNumber) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement