Skip to content

Commit a16d6e6

Browse files
committed
Create AngleBetweenHourAndMinute.java
1 parent 1c3f762 commit a16d6e6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class AngleBetweenHourAndMinute {
2+
3+
private static int getDegree(int minute, int hour){
4+
return Math.abs(minute * 6 - (hour % 12) * 30 - minute / 2);
5+
}
6+
public static void main(String[] args){
7+
int hour = 3;
8+
int minute = 30;
9+
int angle = getDegree(minute, hour);
10+
System.out.println("The angle between the hour and minute hand is: " + angle + " degrees");
11+
}
12+
}

0 commit comments

Comments
 (0)