-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcf1.cpp
More file actions
23 lines (23 loc) · 732 Bytes
/
cf1.cpp
File metadata and controls
23 lines (23 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream> // For input/output operations
using namespace std;
int main() {
// Declare variables
int number;
// Output a message to the console
cout << "Enter a number: ";
// Input from the user
cin >> number;
// Conditional statement to check if the number is even or odd
if (number % 2 == 0) {
cout << number << " is even." << endl;
} else {
cout << number << " is odd." << endl;
}
// Loop to count down from the number
cout << "Counting down: ";
for (int i = number; i >= 0; i--) {
cout << i << " ";
}
cout << endl; // End the output with a newline
return 0; // Return 0 to indicate successful execution
}