let x and y, be the two numbers
since, x+y=40, so x=40-y
then, substitute this equation to xy=320,
we got 40y-y^2=320, or y^2-40y+320=0
the roots of that polinomial are
so you got the two numbers
20+4sqrt(5) and 20-4sqrt(5).
they would be the answer if you play in Real set.