You're not outputting the sum variable to see the result.
Also, when you create a variable, it's initialized with a garbage value, so it's good practice to initialize it with something you want.
#include <iostream>
usingnamespace std;
int main()
{
// initialize the variable to 0.
int sum = 0;
for( int i = 0; i < 4; ++i )
{
if( i % 3 == 0 )
continue;
sum += i;
}
cout << "Sum is: " << sum << endl;
return 0;
}