Asked inUBS,ENO
Angle Between Hour Hand And Minute Hand

Given the time in hours and minutes, you need to calculate the angle between the hour hand and the minute hand.

Note :
There can be two angles between the hour hand and minute hand, you need to print a minimum of two. Also, print the floor value of angle i.e. if the angle is 15.2, you need to print 15.
Input format:
The first line of input contains an integer ‘T’ denoting the number of test cases.

The first and only line of each test case contains two integers H and M denoting the time in hours and minutes.
Output format:
For each test case, print the smaller angle between the hour hand and minute hand.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
Constraints:
1 <= T <= 50
1 <= H <= 12
0 <= M <= 59

Time Limit: 1 sec
CodingNinjas
author
2y

The idea is to take 12:00 (h = 12, m = 0) as a reference.
Steps :
1. Calculate the angle made by hour hand with respect to 12:00 in h hours and m minutes.
2. Calculate the angle made by minute hand wi...read more

CodingNinjas
author
2y
Using reference time
  • The idea is to take the 12:00 i.e. H = 12 and M = 0 as reference time.
  • First, calculate the angle made by the hour hand with respect to 12:00 in H hours and M minutes. In 12 hours t...read more
Help your peers!
Add answer anonymously...
UBS ENO Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter