Programming Miles

Published on December 2016 | Categories: Documents | Downloads: 36 | Comments: 0 | Views: 199
of 2
Download PDF   Embed   Report

Comments

Content

/* * Program ini dibuat oleh : Dini Putri Mandasari - 5111100013 * Nabilla Sabbaha Audria .P - 5111100015 * Kelas A * * Calculates mileage reimbursment. */ #include<stdio.h> /* printf, scanf definition */ #include<stdlib.h> /* system("pause") definition */ #define rate_per_mile 0.45 /* conversion constant of dollars */ int main(void) { double miles, /* distance in miles */ begin, /* input - beginning odometer reading */ end, /* input - ending odometer reading */ reimbursment; /* output - mileage reimbursment */ /* display welcome say program */ printf("Welcome to Calculates Mileage Reimbursment. \n"); /* make a space line */ printf("\n"); /* get and display the beginning odometer reading */ printf("Enter beginning odometer reading (mile) => "); scanf("%lf", &begin); /*get and display the ending odometer reading */ printf("Enter ending odometer reading (mile) => "); scanf("%lf", &end); /* compute the difference value of ending odometer reading and beginning odometer reading */ miles = end - begin; /* make a space line */ printf("\n"); /* display the difference value of ending odometer reading and beginning odometer reading */ printf("You traveled %.2f miles. At $0.45 per mile, \n", miles); /* compute the mileage reimbursment */

reimbursment = miles * rate_per_mile; /* display the milage reimbursment */ printf("your reimbursment is $%.2f . \n", reimbursment); /* make a space line */ printf("\n"); /* display pause of program */ system("pause"); return 0; }

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close