Write a Program in C++ That Using of Counter-Controlled Repetition

// Counter-controlled repetition.
#include <iostream>
using namespace std;

int main()
{
   unsigned int counter = 1; // declare and initialize control variable

   while ( counter <= 10 ) // loop-continuation condition
   {    
      cout << counter << " ";
      ++counter; // increment control variable by 1
   } // end while 

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

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...