I'm fairly new to C, and I have an assignment, this is what I came up with so far:
Code:
#include<stdio.h>int main()
{
float b,e;
printf("Enter beginning odometer reading=>");
scanf("%f",&b);
printf("\nEnter ending odometer reading=>");
scanf("%f",&e);
printf("\nYou traveled %.2f miles. At $0.35 per mile, your reimbursement is %.3f.",(e-b),(e-b)*0.35);
return 0;
}
My question is, how can I get rid of the extra decimal point, when I input the following:
13505.2 (for the beginning odometer reading)
13810.65 (for the ending odometer reading)
It gives me values of 305.40 and 106.890, how do I get rid of the extra zeroes?