Skip to content

Instantly share code, notes, and snippets.

@Cvar1984
Created September 2, 2024 07:05
Show Gist options
  • Save Cvar1984/dab66885ff8b16d6d1f737cb1dcc7e52 to your computer and use it in GitHub Desktop.
Save Cvar1984/dab66885ff8b16d6d1f737cb1dcc7e52 to your computer and use it in GitHub Desktop.
Determine your height with time
local initial_velocity, time, gravity, height;
-- The gravitational acceleration of the Earth is 9.80665 m/s².
gravity = 9.80665;
io.write("Initial acceleration of the object: ");
initial_velocity = io.read("*n");
io.write("Times the object is dropped from a height: ");
time = io.read("*n");
height = initial_velocity * time + 0.5 * gravity * time ^ 2;
print("Your height: ", height);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment