dont know the problem?? why is there error?
Code:
#include <stdio.h>
float calculateCharge (float x);
int main (void)
{
float hour1,hour2,hour3,totalhour;
float cost1,cost2,cost3,totalcost;
printf("Enter hours parked for the three vehicle: ");
scanf("%f%f%f", hour1,hour2,hour3);
totalhour=hour1+hour2+hour3;
cost1=calculateCharge(hour1);
cost2=calculateCharge(hour2);
cost3=calculateCharge(hour3);
printf("Car\tHours\tCharge\n");
printf("1\t%.2f\t%.2f\n", hour1, cost1);
printf("2\t%.2f\t%.2f\n", hour2, cost2);
printf("3\t%.2f\t%.2f\n", hour3, cost3);
printf("Total\t%.2f\t%.2f\n", totalhour, totalcost);
return 0;
}
float calculateCharge (float x)
{
float charge;
if (x>3){
charge=((x-3)*.50)+2;
if (charge>10){
charge=10;}}
else {
charge=2;}
}