Write a program that allows the user to enter a time in seconds and then outputs how far an object would drop if it is in freefall for that length of time. Assume no friction or resistance from air and a constant acceleration of 32 feet per second due to gravity. Use the equation
Distance = * acceleration * time2
#include<iostream>
using namespace std;
#define ACCELERATION 32
int main()
{
//Variables
int time;
double distance;
//Input from the user
cout<<" Enter time(Seconds):";
cin>>time;
//Compute distance using the formula:
//distance=(acceleration*time^2)/2
distance = ((ACCELERATION * time *time)/2);
//Display result
cout<<"Traveled distance:" << distance <<"\n";
}
Result output:
Enter time(Seconds):60
Traveled distance :57600