Even | Java program to find max ( X , Y ) / min ( X , Y ) after P turns ; Driver code ; 1 st test case ; 2 nd test case
import java . util . * ; class Even_odd { public static int findValue ( int X , int Y , int P ) { if ( P % 2 == 0 ) return ( Math . max ( X , Y ) / Math . min ( X , Y ) ) ; else return ( Math . max ( 2 * X , Y ) / Math . min ( 2 * X , Y ) ) ; } public static void main ( String [ ] args ) { int X = 1 , Y = 2 , P = 1 ; System . out . println ( findValue ( X , Y , P ) ) ; X = 3 ; Y = 7 ; P = 2 ; System . out . print ( findValue ( X , Y , P ) ) ; } }