C++ examples for Statement:for
An inside loop controlled by the outer loop's counter variable.
#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; }