-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAngle_Between_Hands.java
More file actions
36 lines (36 loc) · 915 Bytes
/
Angle_Between_Hands.java
File metadata and controls
36 lines (36 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
import java.lang.Math;
class angle_btw_hands
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String time;
time=sc.next();
String[] times = time.split(":");
String h=times[0];
String m=times[1];
int hh=Integer.parseInt(h);
int mm=Integer.parseInt(m);
double ang=Math.abs(30*hh-(5.5*mm));
double angl=360-ang;
System.out.println(Math.min(ang,angl));
}
}
/*
import java.util.Scanner;
class Angle_between
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
String[] time=s.split(":");
int h=Integer.valueOf(time[0]);
int m=Integer.valueOf(time[1]);
double a=Math.abs(30*h-(5.5*m));
double b=360-a;
System.out.print(Math.min(a,b));
}
}
*/