human
Sum of integers upto N with given unit digit ( Set 2 ) | Function to return the required sum.
Decrement N.
Driver code"
Solution in Python:
 ... What is a code to sum of integers upto N with given unit digit ( Set 2 ) and the other steps required?
assistant
#Here is code to sum of integers upto N with given unit digit ( Set 2 ) and the other steps required.
 def getSum ( n , d ) :
	if ( n < d ) :
		return 0
	while ( n % 10 != d ) :
		n -= 1
	k = n // 10
	return ( ( k + 1 ) * d + ( k * 10 + 10 * k * k ) // 2 )
if __name__ == " _ _ main _ _ " :
	n = 30
	d = 3
	print ( getSum ( n , d ) )