Hello you guys. Im writing a program that calculates 4 parameters: velocity, acceleration, distance, time. Part of my program is to implement an output that adds all the times and prints it into min and seconds and the type that im working with is float. The problem that im having is that i could add all the times but i dont know how to seperate them into minutes and seconds. An example just to show you what im doing wrong is right below:

CODE Total_Time = Time_Leg1 + Time_Leg2 + Time_Leg3;
printf("Total time of travel: : %f min %f sec\n", Total_Time, Total_Time);

RESULTING OUTPUT
Total time of travel: 110 min 110.000000 sec

WHAT IT SHOULD BE DOING
Total time of travel: 1 min 10.000000 sec

Could any would give me some suggestions on how bout I can solve this problem?

I would probably store your times in int variables. This variable would store the times in seconds. Then for the final result, I would divide by 60 to get the number of minutes and use the modulus operator to get the seconds.

If you need to store fractions of seconds, then your int variable (or perhaps long) would represent the number of milliseconds or number of centiseconds depending on the accuracy required.