INTRODUCTION The range of a projectil may be calculated given its initial veloci
ID: 3853722 • Letter: I
Question
INTRODUCTION The range of a projectil may be calculated given its initial velocity, v, and the angle at which the projectile is fired.. The range is computed from the equation u/sin(2 * ) where R is the range, the angle 2*0 is in radians, and g (32.2 ft/sec') is the gravitational constant. ASSIGNMENT: Write a C program that asks the user to enter the initial launch angle in degrees and launch velocity in f/sec. Then compute the range of the projectile and print the value to the screen You will need to convert the angle from degrees to radians to use the sin() function in C. Hint: remember that radians = 180° Define g and (3.14159) as symbolic constants in your program. Use the "Code Sections.c" template on Blackboard to write your code. Your program output will look like the illustration shown below. Use your PC's cursor to determine the horizontal and vertical spacing for the output format. OUTPUT FORMAT RANGE OF A PROJECTILE Enter the launch angle in degrees: x Enter the launch velocity in ft/sec: x RESULTS Launch angle xxx.x degrees Launch angle xxx.x radians Launch velocityxx.xx ft/sec Projectile range xxx.xx ft To work a hand example, use an initial velocity of 1000 ft/sec and a launch angle of 30°. SUBMITTING ASSIGNMENTS: Once you have your program working, exit the C compiler that you are using. program file name conforms to the following specifications: Make sure that your sourceExplanation / Answer
#include <stdio.h>
#include <math.h>
#define M_PI 3.14
#define G 32.2
int main()
{
printf("Enter launch angle in degree:");
int la;
scanf("%d",&la);
printf("Enter launch velocity in ft/sec:");
int lv;
scanf("%d",&lv);
double radinAngle = la*M_PI/180;
double range=lv*lv*sin(2*radinAngle)/G;
printf("RESULTS");
printf("LAUNCH ANGLE %d degree",la);
printf(" LAUNCH ANGLE %d radians",radinAngle);
printf(" LAUNCH velocity %d ft/sec");
printf(" Projectile range %lf ft -----",range);
return 0;
}
====================================================
Enter launch angle in degree:12
Enter launch velocity in ft/sec:100
RESULTSLAUNCH ANGLE 12 degree
LAUNCH ANGLE 2147483632 radians
LAUNCH velocity 2147483623 ft/sec
Projectile range 126.255478 ft -----
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.