1. Don't use prompt() as it is intended for debugging only - use a form in your web page instead to collect the values.
2. Don't use document.write - that went out of use when Netscape 4 died as subsequent browsers support the far more powerful innerHTML call instead.
To be able to advise how to set up a for loop to process the five input fields we will first need to see how you have defined the form. You can convert strings to numbers using either Number(str) or (+str)
You can use Math.max() and Math.min() to get the maximum and minimum values.