human
Give me a code to check if a large number is divisible by 11 or not and the other steps required given the following:
Check if a large number is divisible by 11 or not | Function to find that number divisible by 11 or not.
Compute sum of even and odd digit sums.
When i is even , position of digit is odd.
Check its difference is divisible by 11 or not.
Driver code"
Solution in Python:
assistant
#Here is code to check if a large number is divisible by 11 or not and the other steps required.
 def check ( st ) :
	n = len ( st )
	oddDigSum = 0
	evenDigSum = 0
	for i in range ( 0 , n ) :
		if ( i % 2 == 0 ) :
			oddDigSum = oddDigSum + ( ( int ) ( st [ i ] ) )
		else :
			evenDigSum = evenDigSum + ( ( int ) ( st [ i ] ) )
	return ( ( oddDigSum - evenDigSum ) % 11 == 0 )
st = "76945"
if ( check ( st ) ) :
	print ( " Yes " )
else :
	print ( " No ▁ " )