Answer:
#include <iostream>
using namespace std;
void printEvens() {
for (int i = 2; i <= 20; i++) {
if (i % 2 == 0)
cout << i << " ";
}
}
int main() {
printEvens();
return 0;
}
Step-by-step explanation:
- Inside the function, initialize a for loop that goes from 2 to 20.
- Inside the for loop, check if the numbers are divisible by 2. If yes, print the number
- Inside the main, call the function