/* Quarter-Mile Race Write a complete C program that calculates the estimated time (ET) for two cars to finish a quarter-mile race. The estimated time can be calculated using the weight of the car in pounds and the cars horsepower with the formula: ET = (Weight/HP)^(1/3)*(233/40) ============= START OF SAMPLE RUN ======================= Enter weight and HP of car 1: 2996 225 Enter weight and HP of car 2: 2745 190 Car 1 ET: 13.806 Car 2 ET: 14.187 ============= END OF SAMPLE RUN ======================= ============= START OF SAMPLE RUN ======================= Enter weight and HP of car 1: 2900 550 Enter weight and HP of car 2: 3100 650 Car 1 ET: 10.139 Car 2 ET: 9.805 ============= END OF SAMPLE RUN ======================= */ #include #include #include // Used for pow int main(int argc, char* argv[]) { // Declare variables double weight, hp, carOneET, carTwoET; // Gather information and calculate ETs printf("Enter weight and HP of car 1: "); scanf("%lf%lf", &weight, &hp); carOneET = (pow(weight/hp, 1.0/3.0))*233/40; printf("Enter weight and HP of car 2: "); scanf("%lf%lf", &weight, &hp); carTwoET = (pow(weight/hp, 1.0/3.0))*233/40; // Print results printf("\n"); printf("Car 1 ET: %.3lf\n", carOneET); printf("Car 2 ET: %.3lf\n", carTwoET); system("pause"); return 0; }