0% found this document useful (0 votes)
20 views1 page

Projectile Motion Calculator in C

Uploaded by

Rahul Makwana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Projectile Motion Calculator in C

Uploaded by

Rahul Makwana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

/* Projectile Motion

Date:01/09/2025
Urvashiba Gohil
Rahul Makwana
*/

#include <stdio.h>
#include <math.h>
#define g 9.8 // gravitational acceleration (m/s^2)

int main()
{
float v,theta,h,t,r,rad,k;

printf("enter the value of velocity in m/s=");


scanf("%f",&v); // take input for velocity

printf("enter the value of angle(in deg)=");


scanf("%f",&theta); // take input for angle (in degrees)

k=(3.14*theta)/180; // convert theta from degree to radian


t=(2*v*sin(k))/g; // time of flight formula
h=v*v*pow(sin(k),2)/(2*g); // maximum height formula
r=v*v*sin(2*k)/g; // range of projectile formula

printf("t=%f seconds \nH=%f meters\nR=%f meters\n",t,h,r); // display results


}

OUTPUT:

(1) enter the value of velocity in m/s=9


enter the value of angle(in deg)=45
t=1.298250 seconds
H=2.064681 meters
R=8.265304 meters

(2) enter the value of velocity in m/s=9


enter the value of angle(in deg)=30
t=0.917945 seconds
H=1.032213 meters
R=7.155770 meters

(3) enter the value of velocity in m/s=9


enter the value of angle(in deg)=50
t=1.406498 seconds
H=2.423340 meters
R=8.141005 meters

You might also like