[Type C]Q11. Write a program that reads two times, in military format(0900,1730), and prints the number of hours and minutes between the two times. eg: First time: 0900 Second time: 1730, 8 hours 30 minutes

We need to input two distinct times and subtract the first from second to find the difference between both.

Program code:

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in

Output:

Welcome to Computer Tutor!
Please enter the first time:0900
Please enter the second time:1730
8 hours 30 minutes

The first time and second time are taken input from user and difference between the times is calculated and printed on console.

Basic python functionality is demonstrated in above program.

To view all the lessons in chapter 1: http://computertutor.in/class-12-computer-science/chapter-1/

To view entire class 12 computer science study material: http://computertutor.in/resources/

You cannot copy content of this page