1. Free fall body velocity - the solution
Explanation:
The program that was written has the possibility to calculate the height when falling to the ground according to the known formula for uniformly accelerated movement in the vertical direction, where the value of acceleration is equal to the gravitational acceleration in the earth's gravitational field g = 9.81 m / s.
The program further compares the calculated speed with the speed limit entered by the user.
If the calculated speed for the entered H is less than or equal to the limit, then the height should not be increased, because a higher calculated speed would be obtained for the increased height. The if-else command is used for this test.
The program that was written has the possibility to calculate the height when falling to the ground according to the known formula for uniformly accelerated movement in the vertical direction, where the value of acceleration is equal to the gravitational acceleration in the earth's gravitational field g = 9.81 m / s.
The program further compares the calculated speed with the speed limit entered by the user.
If the calculated speed for the entered H is less than or equal to the limit, then the height should not be increased, because a higher calculated speed would be obtained for the increased height. The if-else command is used for this test.
#include <stdio.h>
#include <math.h>
int main()
{
double v,vR,H; //velocity, comparative velocity and initial height
const double G = 9.81; //gravitational acceleration
printf("Enter the initial body height and the comparative speed\n");
scanf("%lf%lf",&H,&vR);
v=sqrt(2*G*H); //body velocity when falling from the initial height H
printf("The velocity of fall is v=%.2f m/s\n",v);
//Does the calculated velocity of the body at the fall reach the comparative one
if(v>vR)
{
printf("Height does not have to be greater than %.2f m because for this height the velocity at fall is greater than %.2f m/s \n",H,vR);
}
else
{
printf("Height have to be greater than %.2f m because for this height the velocity at fall is greater than %.2f m/s \n", H, vR);
}
return 0;
}
#include <math.h>
int main()
{
double v,vR,H; //velocity, comparative velocity and initial height
const double G = 9.81; //gravitational acceleration
printf("Enter the initial body height and the comparative speed\n");
scanf("%lf%lf",&H,&vR);
v=sqrt(2*G*H); //body velocity when falling from the initial height H
printf("The velocity of fall is v=%.2f m/s\n",v);
//Does the calculated velocity of the body at the fall reach the comparative one
if(v>vR)
{
printf("Height does not have to be greater than %.2f m because for this height the velocity at fall is greater than %.2f m/s \n",H,vR);
}
else
{
printf("Height have to be greater than %.2f m because for this height the velocity at fall is greater than %.2f m/s \n", H, vR);
}
return 0;
}
Program execution
To test the program, we will enter values:
10 for height in meters and 12 for comparative velocity in m / s
After starting the application and entering these values, we get:
10 for height in meters and 12 for comparative velocity in m / s
After starting the application and entering these values, we get:
If, on the other hand, we enter the following values:
250 for height in meters and 78 for comparative speed in m / s
After starting the application and entering these values, we get:
250 for height in meters and 78 for comparative speed in m / s
After starting the application and entering these values, we get: