Divide the two given numbers by their common divisors | Function to calculate gcd of two numbers ; Function to calculate all common divisors of two given numbers a , b -- > input integer numbers ; find gcd of a , b ; Driver code
< ? php function gcd ( $ a , $ b ) { if ( $ a == 0 ) return $ b ; return gcd ( $ b % $ a , $ a ) ; } function commDiv ( $ a , $ b ) { $ n = gcd ( $ a , $ b ) ; $ a = ( int ) ( $ a / $ n ) ; $ b = ( int ) ( $ b / $ n ) ; echo " A = " ▁ . ▁ $ a ▁ . STRNEWLINE TABSYMBOL TABSYMBOL " , B = " ▁ . ▁ $ b ▁ . ▁ " " } $ a = 10 ; $ b = 15 ; commDiv ( $ a , $ b ) ; ? >