Answer:
seconds = int(input("Enter time in seconds: "))
hours = int(seconds / 3600)
minutes = int((seconds - (hours * 3600)) / 60)
seconds = seconds - ((hours * 3600) + (minutes * 60))
print("{} hour(s) {} minute(s) {} second(s)".format(hours, minutes, seconds))
Explanation:
*The code is in Python.
Ask the user to enter the time in seconds
Calculate the hours, divide the seconds by 3600 and cast it to the integer
Calculate the minutes, subtract the corresponding seconds in hours you previously found, divide it by 60 and cast the result to the integer
Calculate the seconds, subtract the corresponding seconds in hours and minutes you previously found, the remaining is the seconds you have
Print the hours, minutes, and seconds
For example, if the user enters 7310 as seconds,
hours will be int(7310/3600) = 2
minutes will be int((7310 - (2*3600)) / 60) = 1
seconds will be 7310 - ((2*3600) + (1*60)) = 50