GCD of two numbers formed by n repeating x and y times | Return the Greatest common Divisor of two numbers . ; Prints Greatest Common Divisor of number formed by n repeating x times and y times . ; Finding GCD of x and y . ; Print n , g times . ; Driver Code
< ? php function gcd ( $ a , $ b ) { if ( $ a == 0 ) return $ b ; return gcd ( $ b % $ a , $ a ) ; } function findgcd ( $ n , $ x , $ y ) { $ g = gcd ( $ x , $ y ) ; for ( $ i = 0 ; $ i < $ g ; $ i ++ ) echo ( $ n ) ; } $ n = 123 ; $ x = 5 ; $ y = 2 ; findgcd ( $ n , $ x , $ y ) ; ? >