Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute C Online

 #include <stdio.h>
/*
* Pablo Muñiz Rocandio
* 09/13/2017
* CS 112
* Mileage Reimbursement Calculator
*
* This program calculates the distance that you have travelled and how much is it cost to you, by entering the beggining odometer reading and the ending odometer reading
*/
int main()
#define MONEY_PER_MILE 0.35
{
    float beginningodometer ;
    float endingodometer ;
    
    printf("Enter beginning odometer reading:%.2f\n",beginningodometer = 3657.34 );
    printf("Enter ending odometer reading:%.2f\n",endingodometer = 3800.34);
    scanf("%.2f %.2f",&beginningodometer,&endingodometer);
    float difference = endingodometer - beginningodometer;
        scanf("%.2f - %.2f = %.2f\n",&endingodometer,&beginningodometer,&difference);
        printf("You travelled %.2f  miles\n",difference);
    float product = difference * MONEY_PER_MILE;
        scanf("%.2f * %.2f = %.2f",&difference,MONEY_PER_MILE,&product);
        printf("At $0.35 per mile, your reimbursement is $%.2f\n",product);
    

    return 0;
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.