C++ for statement with only test expression, count by fives

Description

C++ for statement with only test expression, count by fives

#include <iostream>
using namespace std;
int main()//from   w  ww. j a  v a 2  s  .c  o  m
{
   int num=5;                            // Starting value
   cout << "\nCounting by 5s: \n";                // Title
   for (; num<=100;)  // Contains only the test expression.
   {
      cout << num << "\n";
      num+=5;    // Increment expression outside the loop.
   }                           // End of the loop's body
   return 0;
}



PreviousNext

Related