25.5k 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 Urandom
by
5.7k points

1 Answer

7 votes

Answer:

#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;

treeHeight =angleElevation * shadowLength

printf("Tree height: %lf\\", treeHeight);

return 0;

}

Step-by-step explanation:

since we are given the angle of elevation (6.7 degrees) and shadow length (17.5), we simply add the statement treeHeight =angleElevation * shadowLength to compute the tree hieght using the given formular

User Hamish Downer
by
5.2k points