Projectile Motion Calculations: C Program and Coordinates

Verified

Added on  2021/01/09

|4
|447
|153
Homework Assignment
AI Summary
This assignment presents a C program designed to calculate projectile motion. The program takes user inputs for velocity, angle, and time, and then calculates the Cartesian and Polar coordinates of the projectile. The code includes necessary libraries and functions to perform the calculations, providing a practical example of applying physics principles in a programming context. The program is designed to help students understand the concepts of projectile motion and coordinate systems, making it a valuable resource for physics and programming students. This assignment is available on Desklib, a platform that offers AI-based study tools for students.
Document Page
PROJECTILE
POSITION
CALCULATIONS: C
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Table of Contents
1. Write a C program that will prompt the user to enter the velocity in m/s, the angle (alpha)
in degrees, and the time in seconds. After this compute Cartesian coordinates and Polar
coordinates..................................................................................................................................1
Document Page
1. Write a C program that will prompt the user to enter the velocity in m/s, the angle (alpha) in
degrees, and the time in seconds. After this compute Cartesian coordinates and Polar
coordinates.
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
float v,a,t, r, theta;
int x,y;
/* This will ask user to enter value of velocity in m/s , projectile angle in degrees and projectile
time in seconds*/
printf(“Enter projectile velocity in m/s:” \n);
/*Here user will be prompted to enter a value of velocity in m/s, projectile angle in degree and
projectile time in seconds*/
scanf(“%f”, &v);
printf(“Enter projectile angle in degree:”\n);
scanf(“%f”,&a);
printf(“Enter projectile time in seconds:”\n);
scanf(“%s”,&t);
/* Calculation of cartesian coordinates and polar coordinates*/
printf(“ Cartesian cordinates”);
scanf(“%d %d”, &x, &y);
/* Input value of cartesian coordinates (x,y) from user, v is velocity in m/s, a is angle in degree*/
x(t) =v* cos a* t;
/* g is gravitational constant with value 9.81 m/s*s */
y(t)= v*sin a*t -((1/2)*g*t*t);
1
Document Page
/* polar cordinates (r(t), theta(t) for down range distance in m and angle in degree, as a function
of time*/
r(t)=sqrt(x*x+y*y);
/* square root function in library math.h*/
theta=atan(y/x);
/* tan inverse function in library math.h*/
printf(“Cordinates in polar form: %.2f(cos(%.2f)+i.sin(%.2f))”,r, theta);
/* %.2f means that only two decimal places will be printed*/
getch();
return 0;
}
2
chevron_up_icon
1 out of 4
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]