rightTriangles function added