I am having difficulty with a program in my CS class right now and I am wondering if you guys could help.

Basically, I need to find the length/width (should be equal) of the 4 corners(I'll call this variable 'x') of a piece of cardboard, to cut them out to fold the sides up into a tray (hopefully you guys can understand that description :/). The user inputs the total length of both sides of the box, and I need to figure out how to calculate the smallest possible length that x could be.

I have currently figured out how to find x if length and width are different sizes, but when they are equal I cannot figure out how to find it.

Ex. of how to find when they are different sizes:

If L > W

D= L-W

Df= D**.5

And I believe that's all I need to do (sorry I dont have the code w/ me and I wasn't at school today so it's not really fresh in my head).

Do you guys have any idea how I can figure it out when the sides are equal? I'm sorry that my description was awful, just ask if you need me to clarify something.