Question: Write a user-defined function to calculate the square root of a number. Here's the function prototype: double squareRoot (double x) In the main program, your
Write a user-defined function to calculate the square root of a number. Here's the function prototype:
double squareRoot (double x)
In the main program, your program should ask the user to input a number and print out its square root. The program should print an error message if the user enters invalid data such as negative number or non-numeric values.
You are not allowed to use the built-in function sqrt().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
