C++ Odd or Even Checker — Interactive CMD Lab
Inspect the C++ source code above and interact directly with the Command Prompt below
main.cpp
#include
using namespace std;
int main() {
int num;
cout << "Enter an integer: ";
cin >> num;
if (num % 2 == 0) {
cout << num << " is even.";
} else {
cout << num << " is odd.";
}
return 0;
}
💻 Console Output
Microsoft Windows [Version 10.0.22631]
(c) Corporation. All rights reserved.
C:\C++> odd_even.exe
Enter an integer:
Type an integer after Enter an integer: and press Enter ↵
0 Comments