Find if there exists multiple ways to draw line through ( x , y ) to cut rectangle in equal halfs | Java implementation of the approach ; Function that returns true if multiple lines are possible passing through ( x , y ) that divide the given rectangle into two equal parts ; If the point ( x , y ) is the centre of the rectangle ; Driver code
class GFG { static boolean isPossible ( int w , int h , int x , int y ) { if ( x * 2 == w && y * 2 == h ) return true ; return false ; } public static void main ( String [ ] args ) { int w = 1 , h = 2 , x = 1 , y = 2 ; if ( isPossible ( w , h , x , y ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }