Answer:
I am writing the Python program. Let me know if you want the program in some other programming language.
def convertMillis(millis): #function to convert milliseconds to hrs,mins,secs
remaining = millis # stores the value of millis to convert
hrs = 3600000 # milliseconds in hour
mins = 60000 # milliseconds in a minute
secs = 1000 #milliseconds in a second
hours =remaining / hrs #value of millis input by user divided by 360000
remaining %= hrs #mod of remaining by 3600000
minutes = remaining / mins # the value of remaining divided by 60000
remaining %= mins #mod of remaining by 60000
seconds = remaining / secs
#the value left in remaining variable is divided by 1000
remaining %= secs #mod of remaining by 1000
print ("%d:%d:%d" % (hours, minutes, seconds))
#displays hours mins and seconds with colons in between
def main(): #main function to get input from user and call convertMillis() to #convert the input to hours minutes and seconds
millis=input("Enter time in milliseconds ") #prompts user to enter time
millis = int(millis) #converts user input value to integer
convertMillis(millis) #calls function to convert input to hrs mins secs
main() #calls main() function
Explanation:
The program is well explained in the comments mentioned with each line of code. The program has two functions convertMillis(millis) which converts an input value in milliseconds to hours, minutes and seconds using the formula given in the program, and main() function that takes input value from user and calls convertMillis(millis) for the conversion of that input. The program along with its output is attached in screenshot.