You have 80 inches of wire. You can break it into two pieces or leave it intact. You're going to bend the pieces into squares. What are the maximum and minimum possible total areas of these squares?
We can set this problem up by calling one piece of the wire length x, and the other piece length 80-x. We limit x to the region 0 <= x <= 40. If x=0, we only use one piece, and if x>40, we are just retrying combinations we have already looked at.
Since we try ...
This shows how to find maximum and minimum area for a given perimeter.