In: Computer Science
Linda was standing on a bridge dropping rocks into the water below. She noted that it took 5 seconds for each rock to reach the water. Write a program to find the height of the bridge by using formula: Distance= (GT2 ) /2 Where Distance is the height of the bridge in meters; G is a constant (gravity=9.81 meters/second2 ), and T is the time in seconds Note. Declare gravity as constant
Note:- Since in the question no specify programming language is metioned, so I have the write the code in C++
Code:-
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float H,T, G=9.8; // declaring the variables
cout<<"Enter the time(T) taken in seconds ";
cin >>T;
H=(G*pow(T,2))/2;
cout<<"Height of the Brigde is "<<H<<"
meters";
return 0;
}
ScreenShot:-
Thank You....!!!!
For any query, please comment.
If you are satisfied by the above answer, then please thumbs up or
upvote the answer.