From 89f78874d5275c010508d70fb55ffbc6b7052a7c Mon Sep 17 00:00:00 2001 From: Aditya Chouksey Date: Fri, 17 Oct 2025 11:44:45 +0530 Subject: [PATCH] Create find_max_height.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This C++ program calculates the maximum height a ball will reach when thrown vertically upward with a given initial velocity. The program uses the standard equation of motion derived from basic physics: h = v 2 2 g h= 2g v 2 ​ where: 1. h is the maximum height (in meters), 2. v is the initial velocity of the ball (in meters per second), and 3. g is the acceleration due to gravity (9.8 m/s² on Earth). The user inputs the initial velocity, and the program computes and displays the corresponding maximum height. This program helps understand the relationship between velocity and height in projectile motion under uniform gravity. --- physics/find_max_height.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 physics/find_max_height.cpp diff --git a/physics/find_max_height.cpp b/physics/find_max_height.cpp new file mode 100644 index 00000000000..9c1d2413a1e --- /dev/null +++ b/physics/find_max_height.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; + +int main() { + double velocity, gravity = 9.8, maxHeight; + + cout << "Enter the initial velocity of the ball (m/s): "; + cin >> velocity; + + maxHeight = (velocity * velocity) / (2 * gravity); + + cout << "The maximum height the ball will reach is: " << maxHeight << " meters." << endl; + + return 0; +}