Write a Program in C++ That Uses of Counter-Controlled Repetition With The For Statement

// Counter-controlled repetition with the for statement.
#include <iostream>
using namespace std;

int main()
{
   // for statement header includes initialization, 
   // loop-continuation condition and increment. 
   for ( unsigned int counter = 1; counter <= 10; ++counter )
      cout << counter << " ";

   cout << endl; // output a newline
} // end main

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...