C++ for statement nesting Print the numbers 1-5 three times

Description

C++ for statement nesting Print the numbers 1-5 three times

#include <iostream>
using namespace std;
int main()//from  w ww  .  j a  v  a2  s.  c  o  m
{
   int times, num;  // Outer and inner for loop variables
   for (times=1; times<=3; times++)
   {
      for (num=1; num<=5; num++)
      {
         cout << num;
      }          // Inner loop body
      cout << "\n";
   }                                 // End of outer loop
   return 0;
}



PreviousNext

Related