human
Sum of n digit numbers divisible by a given number | find the Sum of having n digit and divisible by the number.
compute the first and last term.
first number which is divisible by given number.
last number which is divisible by given number.
total divisible number.
return the total sum.
Driver code"
Solution in Python:
 ... Can you provide a code to sum of n digit numbers divisible by a given number and the other steps required?
assistant
#Here is code to sum of n digit numbers divisible by a given number and the other steps required.
 def totalSumDivisibleByNum ( digit , number ) :
	firstnum = pow ( 10 , digit - 1 )
	lastnum = pow ( 10 , digit )
	firstnum = ( firstnum - firstnum % number ) + number
	lastnum = ( lastnum - lastnum % number )
	count = ( ( lastnum - firstnum ) / number + 1 )
	return int ( ( ( lastnum + firstnum ) * count ) / 2 )
digit = 3 ; num = 7
print ( totalSumDivisibleByNum ( digit , num ) )