Created
July 21, 2020 05:16
-
-
Save shixiaoyu/2e0f17d82bffa7874c4b54bad18f45f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double angleClock(int hour, int minutes) { | |
if (hour == 12) { | |
hour = 0; | |
} | |
double angle = Math.abs(minutes * 6 - (hour + (double)minutes / 60) * 30); | |
if (angle > 180) { | |
angle = 360 - angle; | |
} | |
return angle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment