Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use C language NOT C++ Use C language NOT C++ For the following program, you should run each of them using Dev-C++. You answer should
Use C language NOT C++ Use C language NOT C++ For the following program, you should run each of them using Dev-C++. You answer should include your code as a text, and screen shots of your program output. Your programs should be commented: [The square root of a number N can be approximated by repeated calculation using the formula NG = 0.5 (LG + N/LG) Where, NG stands for next guess and LG stands for last guess. Write a C language function that calculates the square root of a number using this method. The initial guess will be the starting value of LG. The program will compute a value for NG using the formula given above. The difference between NG and LG is checked to see whether these two guesses are almost identical. If they are, NG is accepted as the square root: otherwise, the next guess (NG) becomes the last guess (LG) and the process is repeated (another value is computed for NG, the difference is checked and so on). The loop should be repeated until the difference is less than 0.005. Write a complete C language program to test your square root function for the following numbers: 4, 120.5, 36.01, and 0.25 (Use an initial guess of 1.0)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started