Find smallest values of x and y such that ax | Java program to find the smallest values of x and y that satisfy " ax ▁ - ▁ by ▁ = ▁ 0" ; To find GCD using Eculcid 's algorithm ; Prints smallest values of x and y that satisfy " ax ▁ - ▁ by ▁ = ▁ 0" ; Find LCM ; Driver code
class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return ( gcd ( b , a % b ) ) ; } static void findSmallest ( int a , int b ) { int lcm = ( a * b ) / gcd ( a , b ) ; System . out . print ( " x ▁ = ▁ " + lcm / a + " y = " + lcm / b); } public static void main ( String [ ] args ) { int a = 25 , b = 35 ; findSmallest ( a , b ) ; } }