#include <iostream> #include <math.h> using namespace std ; int main() { int count=0; double numIn ; cout << "What number would you like me to sqrt a lot? ==> " ; cin >> numIn ; numIn = fabs(numIn); // make it non-negative if (numIn <= 1) cout << "Sorry. I want big numbers." << endl ; else { // Take square root repeatedly until close to 1 while (fabs(numIn-1) > 0.0001 ) { numIn = sqrt(numIn) ; cout << numIn << endl ; count++ ; } cout << "I had to take the square root "<< count << " times." << endl ; } return 0 ; }