diff --git a/Even or Odd using ternary in cpp operators b/Even or Odd using ternary in cpp operators new file mode 100644 index 0000000..e1912a4 --- /dev/null +++ b/Even or Odd using ternary in cpp operators @@ -0,0 +1,13 @@ +#include +using namespace std; + +int main() { + int n; + + cout << "Enter an integer: "; + cin >> n; + + (n % 2 == 0) ? cout << n << " is even." : cout << n << " is odd."; + + return 0; +}