5.6: the for Loop: 10971

Question

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 (By Travis N)

for (count=1; count<41; count++)
{
   count << count << " ";
}

1 comment:

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

    ReplyDelete