Sum of the multiples of two numbers below N | Function to return the sum of all the integers below N which are multiples of either A or B ; If i is a multiple of a or b ; Driver code
function findSum ( n , a , b ) { let sum = 0 ; for ( let i = 0 ; i < n ; i ++ ) if ( i % a == 0 i % b == 0 ) sum += i ; return sum ; } let n = 10 ; let a = 3 ; let b = 5 ; document . write ( findSum ( n , a , b ) ) ;