c++ loop
#include <iostream>
int main() {
// Declare and initialize variables
int n = 5;
// Use a for loop to iterate from 0 to n-1
for (int i = 0; i < n; ++i) {
// Print the current value of i
std::cout << "i: " << i << std::endl;
// Check if i is even
if (i % 2 == 0) {
// If even, print a message
std::cout << "Even number" << std::endl;
} else {
// If odd, print a different message
std::cout << "Odd number" << std::endl;
}
}
return 0;
}