Angle between a Pair of Lines | Java program for the above approach ; Function to find the angle between two lines ; Store the tan value of the angle ; Calculate tan inverse of the angle ; Convert the angle from radian to degree ; Print the result ; Driver Code
import java . util . * ; class GFG { static double PI = 3.14159265 ; static void findAngle ( double M1 , double M2 ) { double angle = Math . abs ( ( M2 - M1 ) / ( 1 + M1 * M2 ) ) ; double ret = Math . atan ( angle ) ; double val = ( ret * 180 ) / PI ; System . out . println ( val ) ; } public static void main ( String [ ] args ) { double M1 = 1.75 , M2 = 0.27 ; findAngle ( M1 , M2 ) ; } }