Write a Program in C++ That Uses of Do...While Repetition Statement

// do...while repetition statement.
#include <iostream>
using namespace std;

int main()
{
   unsigned int counter = 1; // initialize counter

   do 
   {
      cout << counter << " "; // display counter
      ++counter; // increment counter
   } while ( counter <= 10 ); // end do...while 

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

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...