human
Number of positions with Same address in row major and column major order | Returns count of required positions.
horizontal 1D array.
vertical 1D array.
iterating for all possible i.
checking if j is integer.
checking if j lies b / w 1 to N.
iterating for all possible j.
checking if i is integer.
checking if i lies b / w 1 to M.
Driver Code"
Solution in Python:

=====
Give me a code to number of positions with Same address in row major and column major order and the other steps required?
assistant
#Here is code to number of positions with Same address in row major and column major order and the other steps required.
 def getCount ( M , N ) :
	count = 0 ;
	if ( M == 1 ) :
		return N ;
	if ( N == 1 ) :
		return M ;
	if ( N > M ) :
		for i in range ( 1 , M + 1 ) :
			numerator = N * i - N + M - i ;
			denominator = M - 1 ;
			if ( numerator % denominator == 0 ) :
				j = numerator / denominator ;
				if ( j >= 1 and j <= N ) :
					count += 1 ;
	else :
		for j in range ( 1 , N + 1 ) :
			numerator = M * j - M + N - j ;
			denominator = N - 1 ;
			if ( numerator % denominator == 0 ) :
				i = numerator / denominator ;
				if ( i >= 1 and i <= M ) :
					count += 1 ;
	return count ;
if __name__ == ' _ _ main _ _ ' :
	M , N = 3 , 5 ;
	print ( getCount ( M , N ) ) ;