An m pound vehicle traveling on a road at a velocity of v0 ft/sec requires a ret
ID: 3620130 • Letter: A
Question
An m pound vehicle traveling on a road at a velocity of v0 ft/sec requires a retarding force of F = mato stop, where a = (vi^2 - vf^2 )/(2d), (vi = 0). Write a program that calculates the magnitude of the retarding force
needed to stop the car at distances d=10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ft. The program asks the user to input the
weight of the car m and the initial velocity v0 . It then outputs the values of d and F in a table format. You can use
the math library function pow(x,y) to compute xy . To link the math library compile as follows: gcc -lm problem3.c.
Sample program execution:
Enter the weight of the car in pounds>20
Enter the initial velocity>100
it should look like this:
d F
10 10000
20 5000
30 3333
40 2500
50 2000
60 1667
70 1429
80 1250
90 1111
100 1000
please use the basic c programming
Explanation / Answer
//Header file section
#include<stdio.h>
#include<math.h>
void main()
{
int distance,force,mass,a,vf;
clrscr();
printf("Enter the weight of car in pounds:");
scanf("%d",&mass);
printf("Enter initial velocity:");
scanf("%d",&vf);
/*outputting data*/
printf(" D F");
//loop repeats up to 100
for(distance=10;distance<=100;distance+=10)
{
a=pow(vf,2)/(2*distance);
force=mass*a;
printf(" %d %d",distance,force);
}
getch();
}//end main
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.