Previous Next
0 / 15
Module DEMO-33-63DEMO-OOP-33

Free Fall Calculator

DEMO-OOP-33 • Object Oriented Programming

Browser-only practice

Problem Statement

A physics student is studying free fall motion and needs a program to calculate how far an object falls under gravity. When an object is dropped from rest, the distance it falls in meters after t seconds is given by the formula:

d = 0.5 × g × t²

Where:

  • d is the distance fallen (meters)
  • g is the acceleration due to gravity (use 9.8 m/s²)
  • t is the time (seconds)

Write a program that reads the time in seconds and outputs the distance fallen, formatted to 2 decimal places.

Example: If an object falls for 3 seconds, it will fall 0.5 × 9.8 × 3² = 44.10 meters.

Constraints

Time will be between 0 and 100 seconds (inclusive) Use exactly 9.8 m/s² for the acceleration due to gravity Output must be formatted to exactly 2 decimal places

Input Format

A single floating-point number representing the time in seconds.

Output Format

A single line containing the distance fallen in meters, formatted to exactly 2 decimal places.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3.0
44.10
For t=3.0 seconds: d = 0.5 × 9.8 × 3.0² = 0.5 × 9.8 × 9.0 = 44.10 meters

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings