Question: Write a C program that prompts the user to enter the hours, minutes and seconds of a time in the day, t 1 , say,
Write a C program that prompts the user to enter the hours, minutes and seconds of a time in the day, t say, hh mm and ss respectively. Then, it prompts the user to enter and for a later time in the day, t The program computes the difference between the two time instants and prints the result in the form hh : mm : ss Assume the value of the hours is entered using the hour notation rather than hour notation followed by am or pm For example, if the user enters t : : and t : : the program outputs: The time difference t t is : : Hint: Since t hh:mm:ss and t hh:mm:ss The time difference is tthh:mm:ss where ss ss ss mm mm mm and hh hh hh If ss is greater than ss the difference is negative. You want to fix that by borrowing one minute from mmworth seconds to make ss positive. A similar argument applies when mm is larger than mm
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
