A cyclist coasting on a level road slows from a speed of 10

A cyclist coasting on a level road slows from a speed of 10 mi/ hr to 2.5 mi/ hr in one minute. Write a computer program that calculates the cyclist’s constant rate of acceleration and determines how long the cyclist will take to come to rest, given an initial speed of 10 mi/ hr. Hint: Use the equation:   a=vf-vi divided by t

where a is acceleration, t is time interval, vi is initial velocity, and vf is final velocity.) Write and call a function that displays instructions to the program user and a function that computes a, given t, vf and vi

Solution

Here is the code:

#include <stdio.h>

void Calculate ( float initial_velocity, float final_velocity, float time );

int main()

{

float initial_velocity, final_velocity, time;

printf(\"Enter your cycling details to calculate the acceleration:\ \ \");

printf(\"Initial Velocity: \");

scanf(\"%f\",&initial_velocity);

printf(\"Final Velocity: \");

scanf(\"%f\",&final_velocity);

printf(\"Time: \");

scanf(\"%f\",&time);

Calculate (initial_velocity, final_velocity, time );

return 0;

}

void Calculate ( float initial_velocity, float final_velocity, float time )

{

float acceleration;

acceleration = ( final_velocity - initial_velocity ) / time;

printf(\"\ Acceleration: %.2f\",acceleration);

}

A cyclist coasting on a level road slows from a speed of 10 mi/ hr to 2.5 mi/ hr in one minute. Write a computer program that calculates the cyclist’s constant

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site