170k views
1 vote
Simple geometry can compute the height of an object from the the object's shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength. Given the shadow length and angle of elevation, compute the tree height.Sample program:#include #include int main(void) { double treeHeight = 0.0; double shadowLength = 0.0; double angleElevation = 0.0; angleElevation = 0.11693706; // 0.11693706 radians = 6.7 degrees shadowLength = 17.5; printf("Tree height: %lf\\", treeHeight); return 0;}

User BlueMagma
by
5.6k points

1 Answer

5 votes

Answer:

The program to this question can be given as:

Program:

#include <stdio.h> //include header files

#include<math.h>

int main() //main method

{

double treeHeight = 0.0; //declare variables

and assign value

double shadowLength = 0.0;

double angleElevation = 0.11693706;

// (0.11693706 radians = 6.7 degrees) convert number into angle.

shadowLength = 17.5;

treeHeight = shadowLength * tan(angleElevation); //convert number into angle

printf("Tree height: %lf\\", treeHeight); //print value.

return 0;

}

Output:

Tree height: 2.055778

Explanation:

In the above C language program firstly we include the headers. In this header file, we include a (math.h) header file this file helps to use the math function. Then we declare the main method in the main method we declare the variable that is given in the question that are treeHeight, shadowLength , angleElevation. All the variable datatype is double because it stores the floating-point value. Then we apply the formula that is treeHeight = shadowLength * tan(angleElevation). In this formula, the treeHeight variable holds the value. Then we print the variable value for print the double value we use the lf(that is long float).

User Josua
by
5.0k points