human
Program to find all possible triangles having same Area and Perimeter | Function to print sides of all the triangles having same perimeter & area.
Stores unique sides of triangles.
i + j + k values cannot exceed 256.
Find the value of 2 * s.
Find the value of 2 * ( s - a ).
Find the value of 2 * ( s - b ).
Find the value of 2 * ( s - c ).
If triplets have same area and perimeter.
Store sides of triangle.
Sort the triplets.
Inserting in set to avoid duplicate sides.
Print sides of all desired triangles.
Driver Code.
Function call"
Solution in Python:
 ... What is a code to program to find all possible triangles having same Area and Perimeter and the other steps required?
assistant
#Here is code to program to find all possible triangles having same Area and Perimeter and the other steps required.
 def samePerimeterAndArea ( ) :
	se = [ ]
	for i in range ( 1 , 256 , 1 ) :
		for j in range ( 1 , 256 , 1 ) :
			for k in range ( 1 , 256 , 1 ) :
				peri = i + j + k
				mul1 = - i + j + k
				if ( k > 100 ) :
				break
				if ( j > 100 ) :
				break
				if ( i > 100 ) :
				break
				mul2 = i - j + k
				mul3 = i + j - k
				if ( 16 * peri == mul1 * mul2 * mul3 ) :
					v = [ i , j , k ]
					v . sort ( reverse = False )
					se . append ( v )
					se . sort ( reverse = False )
	temp = [ ]
	temp . append ( se [ 0 ] )
	temp . append ( se [ 6 ] )
	temp . append ( se [ 12 ] )
	temp . append ( se [ 18 ] )
	temp . append ( se [ 24 ] )
	for it in temp :
		print ( it [ 0 ] , it [ 1 ] , it [ 2 ] )
if __name__ == ' _ _ main _ _ ' :
	samePerimeterAndArea ( )