I am raw and I wrote a lot of basic programs. There is something wrong in my new schedule program. I want to caltculate total park recipes and write on screen it with car number and hours. This sequence must be Car Hours Charge. In my program, there is only scanf() asking hours to user.User wrote hour and enter, the program get new line.I want to out put like this
Car    Hours     Charge
1       5         3.00
But program output is like
Car    Hours    Charge
1       5
       3.00
This my program source code:
#include<stdio.h>
double calculateCharges ( double time1 );
int main( void )
{ //open main
 double time;
int i;
double TotalCharges=0, TotalTime=0;
printf("Car\tHours\tCharge\t\n");
for(i=1;i<=3;i++)   //there is 3 cars checkin
{  //open for
    printf("%d\t",i);
    scanf("%lf", &time);
    printf("\t");
    TotalTime+=time;
    printf("%lf",calculateCharges(time) ); // fonks calculate
    TotalCharges+=calculateCharges(time);  // for total charge
    puts("");
    } // end for
}  // end main
double calculateCharges ( double time1 )
{  //open fonk
    double totalC=0;
if( time1<=3)       // untill 3 hours, for 2 dolars
{   //open if
    totalC+=2.00;
}   //end if
else if(time1>3)      // after 3 hours, each hours cost 0.5 dolars
{    //open else if
    totalC+=2+(time1-3)*0.5;
}    //end else if
return totalC;
} // end fonk
 
     
     
    