Find N distinct integers with zero sum | Function to print distinct n numbers such that their sum is 0 ; Print 2 symmetric numbers ; Print a extra 0 if N is odd ; Driver code
def findNumbers ( N ) : NEW_LINE INDENT for i in range ( 1 , N // 2 + 1 ) : NEW_LINE INDENT print ( i , end = ' , ▁ ' ) NEW_LINE print ( - i , end = ' , ▁ ' ) NEW_LINE DEDENT if N % 2 == 1 : NEW_LINE INDENT print ( 0 , end = ' ' ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 10 NEW_LINE findNumbers ( N ) NEW_LINE DEDENT