Question: All in C language A triangle is a polygon with three edges and three vertices and it is one of the basic shapes in geometry.

All in C language A triangle is a polygon with three edgesand three vertices and it is one of the basic shapes inAll in C language

A triangle is a polygon with three edges and three vertices and it is one of the basic shapes in geometry. A triangle with vertices A, B, and C is denoted as ABC (Figure 2). Write a function with the name area, which takes as arguments the Cartesian coordinates of the three vertices A(T1,y), B(T2, y2) and C(-13, ys) and it returns the area of the triangle by using the Heron's formula: a+b+c A=VT.(T-a).(T-b)-(-c), 7= where a, b and care the lengths of the vertices BC, AC and AB accordingly which you can calculate by calling the function length from Exercise 1. 2 11 CO 11 ta H TH 1 Figure 2: A triangle ABC with vertices A, B, and C You should call the function area from a main program which will ask from the user to enter the coordinates 21,41, 12, 12, 13, y3 and call the function area with these values as arguments. The function must return the area of the triangle. The program should be continuous until the area is 0. To 2+1 = Exercise 3 - Calculation of the square root of a number The square root of a real number r >0 with relative precision e > 0 can be calculated with the following recursive process (Newton's method): 2 - ] (en+ In - In il (im+). until Write a function with the name mysqrt that takes as arguments two real numbers T and e and calculates the square root according to the aforementioned process. Use the function mysqrt in a program where the user is asked to provide a positive real number and the program prints the square root of this number with relative precision 10-6. The program should be continuous until the user enters a negative number. Note: In order to calculate the square root, you will need to use the fabs function that calculates the absolute value of a real number and which is declared in . Exercise 4 - Comparison of different functions Modify your solution in Exercise 2 in order to additionally print the area of the triangle using the mysqrt function from Exercise 4. Compare the accuracy of the two solutions by printing the error (difference) of the two values. How does the parameter e affect the error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!