#include <cstdlib>
#include <iostream>
usingnamespace std;
int main()
{
int i = 0, n;
cout << "Enter a number: ";
cin >> n;
while (i <= n)
{
if ((i%2)==0)
{
cout << i << " ";
i = i + 1;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
It is supposed to take a number from the user (n) and show all the even numbers leading up to n from 0. All I see is one single 0 and the program gets stuck.