/*
  Do-while loops. see Nyhoff P315319
  
  Halfs an integer until it is zero.
  
  1) Change n to zero, what happens and why?
  
  2) Change do-while back into while loop. What changes in the case above and why?
*/

#include <iostream>
#include <cmath>
using namespace std;

/*
   do
     {
        statements ...
     }
   while (loop condition);
   
   statements are repeated one or more time until loop condition returns false.
*/

int main()
{
   int n=100;

   do
     {
        cout << "n=" << n << endl;
        n/=2;                              // integer division.
     }
   while (n>0);                            // note ; after while.

   return 0;
}
