Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Copy your repaired version of the gravity.c file from your Lab2 directory. Modify the program to read the time from the user as a float

Copy your repaired version of the gravity.c file from your Lab2 directory. Modify the program to read the time from the user as a float value and compute the distance and speed of the falling object. (Don't forget to prompt the user for input).

main() { float gravity, distance, velocity; int time;

/* set the time */ time = 10; gravity = 32;

/*print title*/ printf("***velocity and distance*** ");

/* compute the velocity */ velocity = gravity * time;

/* compute the distance */ distance = gravity * time * time / 2;

/* print the result */ printf("An object falling %f feet in %d seconds ", distance, time); printf("is traveling %f ft/sec ",velocity); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions