Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions

Question

What applied experiences do you have? (For Applied Programs Only)

Answered: 1 week ago

Question

Compare and contrast licensing and subcontracting.

Answered: 1 week ago