An inside loop controlled by the outer loop's counter variable. - C++ Statement

C++ examples for Statement:for

Description

An inside loop controlled by the outer loop's counter variable.

Demo Code

#include <iostream>
using namespace std;
int main()/*from   w  ww .java  2s  . c o m*/
{
   int outer, inner;
   for (outer=5; outer>=1; outer--)
   {
      for (inner=1; inner<=outer; inner++)
      {
         cout << inner;
      }   // End of inner loop.
      cout << "\n";
   }
   return 0;
}

Result


Related Tutorials