For Loops

#include <iostream.h> // 
#include <stdlib.h>// for atof
// This program will demonstrate for loops.

main()
{
int j;
int sum =0, num = 0;

for (int i = 0; i < 4; i++)
    cout << i << '\n';

for (int k = 2; k < 5; k++)
{
    cout << k << '\n';
    sum += k;
}
cout << sum << '\n';

for (j = 0; j <=4; j+=2)
{
    cout << j << '\n';
    num -= j + sum;
    cout << num << '\n';
}

for (int n =0 ; n > num; n-=10)
    cout << n << '\n';
cout << n << '\n';

return 0;
}
/*
0
1
2
3
2
3
4
9
0
-9
2
-20
4
-33
0
-10
-20
-30
-40
*/