human
Check whether sum of digits at odd places of a number is divisible by K | Python3 implementation of the above approach.
Converting integer to string.
Traversing the string.
Driver code"
Solution in Python:
assistant
#Here is code to check whether sum of digits at odd places of a number is divisible by K and the other steps required.
 def sumDivisible ( n , k ) :
	sum = 0
	num = str ( n )
	for i in range ( len ( num ) ) :
		if ( i % 2 != 0 ) :
			sum = sum + int ( num [ i ] )
	if sum % k == 0 :
		return True
	return False
n = 592452
k = 3
if sumDivisible ( n , k ) == True :
	print ( " YES " )
else :
	print ( " NO " )