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

1 Expert Approved Answer
Step: 1 Unlock

Heres the C program split into multiple files as per your task using a bisection method to approxima... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!