human
Can you provide a code to find the sum of all multiples of 2 and 5 below N and the other steps required given the following:
Find the sum of all multiples of 2 and 5 below N | Function to find sum of AP series.
Number of terms.
Function to find the sum of all multiples of 2 and 5 below N.
Since , we need the sum of multiples less than N.
Driver code"
Solution in Python:
assistant
#Here is code to find the sum of all multiples of 2 and 5 below N and the other steps required.
 def sumAP ( n , d ) :
	n = int ( n / d ) ;
	return ( n ) * ( 1 + n ) * ( d / 2 ) ;
def sumMultiples ( n ) :
	n -= 1 ;
	return ( int ( sumAP ( n , 2 ) + sumAP ( n , 5 ) - sumAP ( n , 10 ) ) ) ;
n = 20 ;
print ( sumMultiples ( n ) ) ;