Sum of common divisors of two numbers A and B | print the sum of common factors ; sum of common factors ; iterate from 1 to minimum of a and b ; if i is the common factor of both the numbers ; Driver code ; print the sum of common factors
< ? php function sum ( $ a , $ b ) { $ sum = 0 ; for ( $ i = 1 ; $ i <= min ( $ a , $ b ) ; $ i ++ ) if ( $ a % $ i == 0 && $ b % $ i == 0 ) $ sum += $ i ; return $ sum ; } $ A = 10 ; $ B = 15 ; echo " Sum = " ? >