Answer to Question #128830 in C++ for Mark

Question #128830
I need a function that extracts the square root of a number.
1
Expert's answer
2020-08-13T13:16:25-0400
#include <iostream>
#include <cmath>
using namespace std;


double squareRoot(double number)
{
    return pow(number,0.5);
}


int main()
{
    cout << "Enter a number: ";
    double number;
    cin >> number;
    cout << "Square root of " << number << " is " << squareRoot(number) << endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS