I need to convert the time given in seconds (time_target) for 3 variables (hour, min, sec)
I have a problem with the second of the program's output.
I would appreciate your help.the program written in C. thanks.
Look at what you substract from time after calculating the number of minutes. Does that look right to you? PS: MINUE should be MINUTE? Also, hour/min/sec and time_target should be local to main. It would also be preferable to read the value for time_target with something like scanf instead of setting it to a constant value.
#define HOUR 3600
#define MIN 60
int main(){
int time_target=4600;
int hour=time_target/HOUR;
int second=time_target % HOUR;
int minute=second/MIN;
int second %= MIN;
printf("%.2d:%.2d:%.2d"),hour,minute,second);
return 0;
}