Number of triangles formed by joining vertices of n | Function to find the number of triangles ; print the number of triangles having two side common ; print the number of triangles having no side common ; initialize the number of sides of a polygon
def findTriangles ( n ) : NEW_LINE INDENT num = n NEW_LINE print ( num , end = " ▁ " ) NEW_LINE print ( num * ( num - 4 ) * ( num - 5 ) // 6 ) NEW_LINE DEDENT n = 6 ; NEW_LINE findTriangles ( n ) NEW_LINE