Give a time in numbers we can convert it into words. For example: 5:00 five o' clock 5:10 ten minutes past five 5:15 QUARTER PAS...

Give a time in numbers we can convert it into words. For example:

 5:00  five o' clock    5:10   ten minutes past five  5:15  QUARTER PAST FIVE

Write a program which first inputs two integers, the first between 1 and 12 (both inclusive) and second between 0 and 59 (both inclusive) and then prints out the time they represent, in words. Your program should follow the format of the examples above.

SAMPLE DATA:

INPUT: TIME:  3,0     OUTPUT:  3:00    three o' clock
INPUT: TIME:  7,29    OUTPUT:  7:29    twenty nine minutes past seven
INPUT: TIME:  6,34    OUTPUT:  6:34    twenty six minutes to seven
INPUT: TIME: 12,1     OUTPUT:  12:01   one minute past twelve
INPUT: TIME: 12,45    OUTPUT:  12:45   quarter to one
INPUT: TIME: 10,59    OUTPUT:  10:59   one minute to eleven
INPUT: TIME: 14:60    OUTPUT:  incorrect input

Test your program for the data values given in the examples above and some random data.

Have something to say? Log in to comment on this post.

0 comments