Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variable
double height;
// gravitational acceleration
double g=9.8;
cout<<"Please enter initial height:";
cin>>height;
// h=ut+(gt^2)/2
// here u, initial velocity is 0
// after simplification
double t=sqrt(2*height/g);
// print the time
cout<<"time taken by ball to hit the ground is:"<<t<<" seconds"<<endl;
return 0;
}
Step-by-step explanation:
Read the initial height from user. Declare and initialize the earth gravitational acceleration "g=9.8" .Then the equation is h=ut+(gt^2)/2, here u is initial velocity which is 0.Then after simplify the equation t=sqrt(2*h/g). Put the values in the equation and find the time taken by ball to hit the ground.
Output:
Please enter initial height:100
time taken by ball to hit the ground is:4.51754 seconds