c++ homework help

uppose that the input is 100 20 –8 50 20. What is the output of the following C++ code?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 int sum = 0;
int num;
int j;

for (j = 1; j <= 4; j++)
{
    cin >> num;
    if (num < 0)
        continue;

    sum = sum + num;
}
Question is just worth a large portion of final homework assignment and I am stuck. Thanks for any help
cout << sum << endl;
Last edited on
closed account (48T7M4Gy)
Why not run it as a program and see what happens?
Topic archived. No new replies allowed.