Question
Show C code for below. Task: Write a program than calculates the square root of a positive number entered by the user Instructions: Write a
Show C code for below.
Task:
Write a program than calculates the square root of a positive number entered by the user
Instructions:
Write a main module (fileMain.c) that prompts the user for a value and prints the calculated square root
Write a square root module (filessqrt.candsqrt.h) which implements a function with the signature doubleSquareRoot(double)
Write a correspondingMakefileto compile the program
Square Root Approximation Algorithm:
Input: positive real numberN
Output: square root ofN
Approximate the square root by use of a range {L,R}, whereLsqrt(N) R
Start with the range {0,max(1,N)}
Calculate the middle of the rangeM=L+ (R-L)/2
If the square root ofNlies in the lower half of the range, use {L,M} as new range; otherwise use {M,R}
Repeat the bisection until the range is smaller than 1*10-5
OutputM
Hint: Lsqrt(N) Ris equivalent toL*LNR*R
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the C program split into multiple files as per your task using a bisection method to approxima...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