/* Trajectory Calculation (15 points) From physics we know that the horizontal travel distance of a projectile is given by this formula: v*cos(Q) d = -------- * ( v*sin(Q) + sqrt ( (v*sin(Q))^2 +2*g*y0) ) g where * g: the gravitational constant (9.80 m/s^2) * Q: launch angle for the projectile * v: launching velocity * y0: starting elevation of the projectile * d: horizontal travel distance at the time of impact Write a complete C program that reads Q, v, and y0 from the keyboard and calculates and prints d. The angle Q must be read in degrees. The launch speed v must be in m/s and y0 must be in meters. You can hardcode the gravitational constant and assume that the user will enter correct values (i.e., no error checking is required). SAMPLE RUN #1: Enter launch angle Q (in degrees): 45 Enter launching velocity v (in m/s): 20 Enter starting elevation y0 (in meters above 0): 0 The horizontal travel distance before the impact is 40.8163 meters SAMPLE RUN #2: Enter launch angle Q (in degrees): 70 Enter launching velocity v (in m/s): 50 Enter starting elevation y0 (in meters above 0): 10 The horizontal travel distance before the impact is 167.539 meters */ #include #include #include #define g 9.80 int main(void) { double Q, v, y0; printf("Enter launch angle Q (in degrees): "); scanf("%lf", &Q); Q = (Q/180.0)*M_PI; // convert to radians printf("Enter launching velocity v (in m/s): "); scanf("%lf", &v); printf("Enter starting elevation y0 (in meters above 0): "); scanf("%lf", &y0); double d = (v*cos(Q))/g *(v*sin(Q) + sqrt((v*sin(Q))*(v*sin(Q)) +2*g*y0)); printf("\nThe horizontal travel distance before the impact is %g meters\n\n",d); system("pause"); }