Question #98765

print the square roots of the first 25 odd positive integers using do while loop.

Expert's answer

// do_loop.cpp
#include <iostream>
#include <cmath>

int main()
{
   int i = 1;
   int count=0;
   do {
       std::cout << "Sqrt(" << i << ") = " << std::sqrt(i) << std::endl;
       i+=2;
       count++;
   } while (count<25);

   return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS