Ok, this is for a class. We were required to write a program to calculate mileage reimbursement for a salesperson at a rate of $0.45 per mile. The program has to take the starting and ending mileage as inputs and then display distance traveled and total reimbursement. I have writen this and it compiles fine, but when I run it it quits out half way through. Bare with me, I'm pretty new at this so I might have made some stupid mistake, but can anyone help me out and maybe show me what I have wrong?
Code:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
float miles, odometer1, odometer2, reimbursement, rate;
printf("MILEAGE REIMBURSEMENT CALCULATOR.\n");
printf("Enter the beginning odometer reading:>");
scanf("%f", &odometer1);
printf("\nEnter the ending odometer reading:>");
scanf("%f", &odometer2);
miles = odometer2 - odometer1;
printf("\nSalesperson traveled %6.2f", miles);
rate = 0.45;
reimbursement = miles * rate;
printf("\nTotal owed reimbursement is %6.2f", reimbursement);
getchar();
return 0;
}