Ans.: The user will input hour and minute of the time and the method should give the angle between the hour hand and minute hand at that given time.
- input: 9 30, output: The angle between hour hand and minute hand is 105 degrees
- input: 13 30, output: The angle between hour hand and minute hand is 135 degrees
The logic is to find the difference in the angle of hour and minute hand from the position of 12 O Clock, when angle between them is zero. Each hour on the clock represent an angle of 30 degrees (360 divided by 12). Similarly, each minute on the clock will represent an angle of 6 degrees (360 divided by 60) and the angle for an hour will increase as the minutes for that hour increases. So, our code will be
No comments:
Post a Comment