human
To check divisibility of any large number by 999 | function to check divisibility.
Append required 0 s at the beginning ..
add digits in group of three in gSum.
group saves 3 - digit group.
calculate result till 3 digit sum.
Driver code"
Solution in Python:
assistant
#Here is code to to check divisibility of any large number by 999 and the other steps required.
 def isDivisible999 ( num ) :
	n = len ( num ) ;
	if ( n == 0 or num [ 0 ] == '0' ) :
		return true
	if ( ( n % 3 ) == 1 ) :
		num = "00" + num
	if ( ( n % 3 ) == 2 ) :
		num = "0" + num
	gSum = 0
	for i in range ( 0 , n , 3 ) :
		group = 0
		group += ( ord ( num [ i ] ) - 48 ) * 100
		group += ( ord ( num [ i + 1 ] ) - 48 ) * 10
		group += ( ord ( num [ i + 2 ] ) - 48 )
		gSum += group
	if ( gSum > 1000 ) :
		num = str ( gSum )
		n = len ( num )
		gSum = isDivisible999 ( num )
	return ( gSum == 999 )
if __name__ == " _ _ main _ _ " :
	num = "1998"
	n = len ( num )
	if ( isDivisible999 ( num ) ) :
		print ( " Divisible " )
	else :
		print ( " Not ▁ divisible " )