/* File: accelio.c Interactively calculate the acceleration based on the mass, friction coefficient, and time from the terminal */ #include #define M_G 9.81 /* gravitational acceleration constant g */ int main() { /* declare variables */ double a, mu, m, p, t; /* prompt the user for input of m, mu, and t */ printf("***** Acceleration Calculator *****\n\n"); printf("Please enter value for mass in kilogram\n"); scanf("%lf", &m); printf("mass is %lf (kg)\n\n", m); printf("Please enter value for friction coefficient\n"); scanf("%lf", &mu); printf("friction coefficient is %lf\n\n", mu); printf("Please enter value for time in second\n"); scanf("%lf", &t); printf("time is %lf (s)\n\n", t); /* calculate the acceleration based on the user input */ p = 4*(t-3)+20; a = (p-mu*m*M_G)/m; /* display output */ printf("Acceleration a = %f (m/s^2)\n", a); return 0; }