human
Give me a code to subsequences of size three in an array whose sum is divisible by m and the other steps required given the following:
Subsequences of size three in an array whose sum is divisible by m | Python program to find count of subsequences of size three divisible by M ..
Three nested loop to find all the sub sequences of length three in the given array A [ ] ..
checking if the sum of the chosen three number is divisible by m ..
Driver code"
Solution in Python:
assistant
#Here is code to subsequences of size three in an array whose sum is divisible by m and the other steps required.
 def coutSubSeq ( A , N , M ) :
	sum = 0
	ans = 0
	for i in range ( 0 , N ) :
		for j in range ( i + 1 , N ) :
			for k in range ( j + 1 , N ) :
				sum = A [ i ] + A [ j ] + A [ k ]
				if ( sum % M == 0 ) :
					ans = ans + 1
	return ans
M = 3
A = [ 1 , 2 , 4 , 3 ]
N = len ( A )
print coutSubSeq ( A , N , M )