Skip to content

Instantly share code, notes, and snippets.

@Cvar1984
Created September 3, 2024 08:48
Show Gist options
  • Save Cvar1984/1aec7a2016646da5bfd70873dc70df71 to your computer and use it in GitHub Desktop.
Save Cvar1984/1aec7a2016646da5bfd70873dc70df71 to your computer and use it in GitHub Desktop.
Find Gravity by free fall test
io.write("Initial acceleration of the object in m/s: ");
local initial_velocity = io.read("*n")
io.write("Height in meter: ")
local height = io.read("*n")
io.write("Times the object is dropped from a height in sec: ")
local time = io.read("*n")
local gravity = 2 * (height - initial_velocity * time) / time ^ 2
print(string.format("The acceleration due to gravity is: %s m/s^2", gravity))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment