Write a for loop that prints the integers 1 through 40, separated by spaces or new lines. You may use only one variable, count which has already been declared as an integer.

LANGUAGE: C++

CHALLENGE:

Write a for loop that prints the integers 1 through 40, separated by spaces or new lines. You may use only one variable, count which has already been declared as an integer.

SOLUTION:

for (count = 1; count <= 40; count++)
{
    cout << count << endl;
}