fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x = 10, y = 20;
  6.  
  7. // Using ternary operator
  8. int max_val = (x > y) ? x : y;
  9.  
  10. cout << "The maximum value is " << max_val;
  11. return 0;
  12. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
The maximum value is 20