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.

For the purposes of this assignment you can assume that the inputs are correct (that is, you are not going to have more than 59seconds or more than 59 minutes).


Ex (the blue text indicates user input):

    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:

Good luck!