V22.0002 - ASSIGNMENT 1

Write a program that computes the difference between two time readings.

The times are read into the program as integers of at most 6 digits (without leading zeros): hhmmss, where hh stands for hour, mm minutes and ss seconds. The difference should be displayed in the same format (called "military format").

The difference can be both positive and negative. It doesn't matter in which direction it's negative, as long as it's consistent. That is, you can subtract the second time from the first time or the second time from the first.

You can assume, for now, that the inputs are correct (that is, you are not going to have more than 59 seconds or more than 59 minutes).

Ex:

```    Enter first time:  230000
Enter second time: 210001
Time difference:    15959

Enter first time:  123245
Enter second time: 112955
Time difference:    10250

Enter first time:   23245
Enter second time:  32815
Time difference:    -5530

Enter first time:     245
Enter second time:    235
Time difference:       10
```
Notes and Hints:
• The above example is for 4 separate runs corresponding to the following times. Note that here we are subtracting the second time from the first time.
1. 11:00:00 PM and 9:00:01 PM [difference is 1:59:59, or 1 hr 59 mins 50 secs]
2. 12:32:45 PM and 11:29:55 AM [= 1:02:50, or 1 hr 2 mins and 50 secs]
3. 2:32:45 AM and 3:28:15 AM [= -0:55:30, or negative 55 mins 30 secs]
4. 0:02:45 AM and 0:02:35 AM [= 0:00:10, or in other words 10 seconds]

• The best way to compute the difference is to:
1. Isolate the different parts of each time: hours, minutes and seconds (use the mod operator % ... hint, hint, hint; you could use integer division instead, which may be more intuitive for some).
2. Compute the time in terms of seconds (1 hour = 3600 seconds, 1 minute = 60 seconds).
3. Compute the difference in seconds.
4. Convert the above number into hours, minutes and seconds (again the mod operator %, but with a different base ... hint, hint, hint).
5. Create the new 6-digit integer (the time in military format) and print it.

• You are NOT being asked to convert a PM or AM time to military time format. The user should be entering the time in military format.