Question: Please add meaningful comments to this code that explains in detail what each part of the code does. Thank you!!! #include int main(void) { float

Please add meaningful comments to this code that explains in detail what each part of the code does.

Thank you!!!

#include int main(void) {

float dist; printf("Enter distance: "); scanf("%f", &dist);

int pass; printf("Enter Number of passengers: "); scanf("%d", &pass);

int airport; printf("0. Going to airport 1.Coming from Airport: "); scanf("%d", &airport); float fare = 0;

float value = (int)(dist * 10 + .5); dist = value / 10; fare += (1.8*dist); if(pass == 2) fare += 1; else if(pass > 2)

{ fare += (0.5*(pass-1)); }

if(airport == 0) fare += 2; if(fare < 5.0) fare = 5.0; printf("Total fare = %0.1f", fare);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!