| Loops Worksheet #1 | Name - |
In the right margin, trace the variables & show what output would be displayed
by the following program(s).
1.
#include <iostream>
using namespace std;int main()
{
int i = 1;
int j = 13;
int k = 0;
int m = 4;
for (i = 1; i < 13; i = i + 3)
{
cout << i << endl;
}
for (j = 9; j >= 3; j -= 2)
{
cout << j << endl;
}
for (k = 2; k < m * 2; k++)
{
cout << k << endl;
if (k >= 6)
{
break;
}
}
return 0;
}// end of main