Question: Write in C program Write a program, add_hms24.c, that starts by asking the user to enter a time as hours, minutes and seconds using a

Write in C program Write a program, add_hms24.c, that starts by askingthe user to enter a time as hours, minutes and seconds usingWrite in C program

Write a program, add_hms24.c, that starts by asking the user to enter a time as hours, minutes and seconds using a 24 hour clock. The program will print the following message: Enter an initial 24-hour time as hours minutes and seconds (o to stop): The program will then ask the user to enter an amount in hours, minutes and seconds to add: Enter the time to add as hours minutes and seconds: The program will add these two times together and print the time that results from adding the indicated number of hours, minutes and seconds to the initial time of day. The result will be printed using a 24 hour clock. Your program must not convert the time to fractional days but should add them as separate hours, minutes and seconds. Sometimes adding times will cause a carry over, which you will need to take into account in your calculations. For example, adding 7:30:50 + 1:29:50 = 9:00:40. When we add the seconds, they yield 100, which is 1 minute and 40 seconds, so we need to carry the extra minute over to the minute column. Since the minutes already sum to 59, this makes the minutes go to 60. But 60 minutes is the next hour, so we make the minutes zero and carry a over to the hour. You should, and MUST, use modulus and integer division in your calculations. The number of days can be calculated by dividing the hours resulting from the calculation by 24 and, if it is greater than 0, you know it is not today. If the resulting time is tomorrow, your program should print the time followed by the word "tomorrow". If it is more than 1 day in the future, it should print something like "in 3 days" after the time. Execution and Output Example (Multiple runs of the program): Enter an initial 24-hour time as hours minutes and seconds: 7 30 0 Enter the time to add as hours minutes and seconds: 500 Total is 12:30:00 Enter an initial 24-hour time as hours minutes and seconds: 7 30 0 Enter the time to add as hours minutes and seconds: 8 30 0 Total is 16:00:00 Enter an initial 24-hour time as hours minutes and seconds: 7 30 0 Enter the time to add as hours minutes and seconds: 32 300 Total is 16:00:00 tomorrow Enter an initial 24-hour time as hours minutes and seconds: 7 30 0 Enter the time to add as hours minutes and seconds: 80 300 Total is 16:00:00 in 3 days Enter an initial 24-hour time as hours minutes and seconds: 7 30 50 Enter the time to add as hours minutes and seconds: 1 58 50 Total is 9:29:40 SUBMISSION

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!