When an object is falling because of gravity, the following formula can be used to determine the distance the object falls in a specific time period: d = ½ gt2 The variables in the formula are as follows: d is the distance in meters, g is 9.8 m/s^2 , and t is the amount of time, in seconds, that the object has been falling. Write a program named falling Distance that accepts an object’s falling time (in seconds starting from 0, 1, 3, …, 10) as an argument using c++ programming
Explanation:
Here is the code which takes the object's falling time as the user input.
Then, it finds the distance travelled while falling using (1/2) * g * t * t
Code:
#include <iostream>
using namespace std;
int main()
{
float t;
cout<<"Enter object's falling time: ";
cin>>t;
float d = (9.8*t*t)/2.0;
cout<<"Distance travelled: "<<d;
return 0;
}
Output:
PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
Get Answers For Free
Most questions answered within 1 hours.