Third Equation of motion, How to implement using C language
The third equation of motion is used to deduce the relation between initial velocity, final velocity, displacement, and acceleration without time.
want to check the implementation of Second equation of motion, click here.
Third equation of motion is
v * v = u * u + 2 * a * s
s: total displacement
u: initial velocity
v: final velocity
a: constant acceleration
In function CalculateDisplacement, we are calculating the value of displacement.
want to check the implementation of First equation of motion, click here.
as you can see in our program we are considering u=0 if you want you can set initialVelocity variable value as per your choice or you can ask it from user too.
Third equation of motion |
Algorithm:
Without wasting any of your precious time let's try to understand how the algorithm is implemented.want to check the implementation of Second equation of motion, click here.
Third equation of motion is
v * v = u * u + 2 * a * s
s: total displacement
u: initial velocity
v: final velocity
a: constant acceleration
In function CalculateDisplacement, we are calculating the value of displacement.
want to check the implementation of First equation of motion, click here.
as you can see in our program we are considering u=0 if you want you can set initialVelocity variable value as per your choice or you can ask it from user too.
Code:
#include stdio.h //please make it correct
// this is the implementation of 3rd equations of motion.
void CalculateDisplacement(float a,float u,float v){
float displacement=0;
displacement = ((v * v) - (u * u) ) / (2.0 * a);
printf("Displacement Value is %f",displacement);
}
int main() {
float acceleration=0;
float initialVelocity=0;
float finalVelocity=0;
//printf("How much is the initial Velocity of element:");
//scanf("%f",&initialVelocity);
printf("Acceleration value:");
scanf("%f",&acceleration);
printf("\n");
printf("Final Velocity value:");
scanf("%f",&finalVelocity);
printf("\n");
CalculateDisplacement(acceleration,initialVelocity,finalVelocity);
return 0;
}
The sample output of this code is after applying the value of the acceleration of 5 and final velocity 50.
Thanks for reading this, for any implementation please ask in the comment section.
want to check the implementation of First equation of motion, click here.
want to check the implementation of Second equation of motion, click here.
Comments
Post a Comment