Read the problem statement here: https://practice.geeksforgeeks.org/problems/angle-between-hour-and-minute-hand/0
To solve this we have to keep two things in mind. First, hour hand completes 360 degrees in 12 hours.
360 degrees in (60 * 12) minutes = 720 minutes Then how many degrees in one minute = 360 / 720 degrees = 0.5 degrees
Second, minute hand completes 360 degrees in one hour i.e. 60 minutes
360 degrees in 60 minutes 1 minute = 360 / 60 degrees = 6 degrees
Remember, there are two corner cases too. Set both hour and minute to zero when their value is 12 and 60 respectively.
Read this interesting article on clocks - Maths around the clock.