# Thread: Write a computer program that calculates the cyclists constant rate of acceleration

1. ## Write a computer program that calculates the cyclists constant rate of acceleration

Question: 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 / time

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

The teacher told me that you have written the wrong code.

Here is my code: Tell me what is the wrong ?
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:\n\n");

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("\nAcceleration: %.2f",acceleration);

}``` 2. > Write a computer program that calculates the cyclist’s constant rate of acceleration
This you've done.

> and determines how long the cyclist will take to come to rest,
This you haven't. 3. Originally Posted by Salem > Write a computer program that calculates the cyclist’s constant rate of acceleration
This you've done.

> and determines how long the cyclist will take to come to rest,
This you haven't.
Hi, tell me that how to do that. Please give me some point for that determines. 4. Originally Posted by Salem > Write a computer program that calculates the cyclist’s constant rate of acceleration
This you've done.

> and determines how long the cyclist will take to come to rest,
This you haven't.
I think I should have to find out time to stop as given this code.
Code:
`  time = (final_velocity - initial_velocity) / acceleration;` 5. I keep looking at that equation and trying to figure out how to use it to travel back in time.

Anyway, yes, that's right. Just plug in the numbers to solve for time. I think it means the total time from 10 mph to stopping.

It'd also be nice to prompt the user for the units to use for time, so you can format the output into minutes and seconds. Popular pages Recent additions acceration, time, velocity 