Exercise 1: Write a C++ program that computes the sum of even numbers less than or equal to n, where n is given by the user.
Exercise 2: What is the output of the following code?
#include <iostream>
using namespace std;
int main() {
int n = 4;
int i = 1;
int c = 0;
while (i < n) {
if (i % 2 == 0) {
i += 2;
} else {
--i;
}
c++;
}
cout << "c = " << c << endl;
cout << "i = " << i << endl;
}