Check if X can be converted to Y by converting to 3 * ( X / 2 ) or X | C ++ program for the above approach ; Function to check if X can be made equal to Y by converting X to ( 3 * X / 2 ) or ( X - 1 ) ; Conditions for possible conversion ; Otherwise , conversion is not possible ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void check ( int X , int Y ) { if ( X > 3 ) { cout << " Yes " ; } else if ( X == 1 and Y == 1 ) { cout << " Yes " ; } else if ( X == 2 and Y <= 3 ) { cout << " Yes " ; } else if ( X == 3 and Y <= 3 ) { cout << " Yes " ; } else { cout << " No " ; } } int main ( ) { int X = 6 , Y = 8 ; check ( X , Y ) ; return 0 ; }