stupid problem. answer = 0.0
the code is pretty much a mess because i've been trying everything to figure this out on my own. every time i compile and test the program, no matter what values i put in i end up with 0.0 for the acceleration answer.
i needed at least 1 user defined function for the problem i'm doing or else it would all be in the main.
any help will be greatly appreciated.
double calc_answer(double, double, double); /*User defined function*/
double show_answer(double); /*User defined function*/
double vi=0, /*initial velocity input in meters per second*/
vf=0, /*final velocity input in meters per second*/
time=0, /*time input in seconds*/
accel1=0, /*acceleration calculation*/
accel=0; /*acceleration output in meters per second squared*/
printf("\n All values in seconds, meters per second, or meters per
printf("\n Please enter the initial velocity:"); /*input initial
printf("\n Please enter the final velocity:"); /*input final
printf("\n Please enter the time:"); /*input time*/
calc_answer(vi, vf, time);
return(vi, vf, time);
double calc_answer(double vi, double vf, double time)
double accel1, /*acceleration part 1*/
accel; /*final acceleration calculation value*/
accel1 = vf-vi; /*Calculation of acceleration part 1*/
accel = accel1/time; /*final calculation of acceleration*/
double show_answer(double accel)
printf("\n The acceleration is %.1lf \n\n\n\n", accel);