Good evening fellow programmers. I\'m going through C programming and I need som
ID: 3634304 • Letter: G
Question
Good evening fellow programmers. I'm going through C programming and I need some help. This problem needs to be answered with C programming, not C++ programming. Also, please comment as much as possible. Thank you to those who have helped in the past with basic comments. I seem to be catching on. Furthermore, there are trial run examples, whereas the inputs have to match the outputs exactly. Thank you all for your guidance with these tough problems.
A right triangle is a triangle that has a 90-degree angle. The side opposite the 90-degree angle is called the hypotenuse and the sides adjacent to the 90-degree angle are called legs. Consider a right triangle with sides a, b, c, where a, b are the legs and c is the hypotenuse. The following equation
holds
c^2 = a^2 + b^2:
Let be the angle (in degree) between a, c, and B(Beta) be the angle (in degree) between b, c. Then we have
alph = (180/pi)arctan(b/a), Beta = (180/pi)arctan(a/b), alph + Beta = 90.
Write a program triangle.c that prompts the user for the double-precision legs of a right triangle
and prints the hypotenuse and the smallest angle (in degree) of that triangle with 1-decimal point
precision.
Include a function void Compute(double *cp, double *anglep, double a, double b) that
computes the hypotenuse and the smallest angle of the right triangle with legs a, b, and stores
them respectively in the variables pointed by cp and anglep.
Sample runs:
(~)$ a.out
Legs: 3.0 4.0
Hypotenuse: 5.0
Smallest angle: 36.9 degree
(~)$ a.out
Legs: 5 10
Hypotenuse: 11.2
Smallest angle: 26.6 degree
(~)$ a.out
Legs: 2.5 2.5
Hypotenuse: 3.5
Smallest angle: 45.0 degree
(~)$
Explanation / Answer
#include #include #include------------------------------------------for all math functions #define PI 3.14----------------------------------------------defined previous the value of PI void compute(float *,float *,float *,float,float);-------function declaration void main() {float a,b,alpha,beta,hy; clrscr(); printf(" Enter the values of a , b :"); scanf("%f%f",&a,&b); compute(&alpha,&beta,&hy,a,b);----------------------sending the address of variables printf(" Hypotenious = %f",hy); if(alphaRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.