I have written a program to change seconds value into seconds, minutes, hours, and Days. All other values are giving exact output except Hours. Whenever a user gives more than 86400 value it gives more than 24 hours value which I don't want. ..
int days = totalSeconds / 86400;
totalSeconds -= days * 86400;
int hours = totalSeconds % 3600;
totalSeconds -= hours * 3600;
int minutes = totalSeconds / 60;
int seconds = totalSeconds % 60;