Even | Javascript program to find max ( X , Y ) / min ( X , Y ) after P turns ; 1 st test case ; 2 nd test case
function findValue ( X , Y , P ) { if ( P % 2 == 0 ) return parseInt ( ( Math . max ( X , Y ) / Math . min ( X , Y ) ) , 10 ) ; else return parseInt ( ( Math . max ( 2 * X , Y ) / Math . min ( 2 * X , Y ) ) , 10 ) ; } let X = 1 , Y = 2 , P = 1 ; document . write ( findValue ( X , Y , P ) + " " ) ; X = 3 , Y = 7 , P = 2 ; document . write ( findValue ( X , Y , P ) ) ;