Write a JavaScript program to calculate the average of 5 numbers entered by the user through a prompt() method.
<html>
<head>
<title>Average of 5 numbers entered</title>
</head>
<body>
<script>
var sum = 0;
var n;
var txt = "Average of numbers : ";
for(var i=0; i<5; i++)
{
n = parseInt(prompt("Enter the number", "0"));
sum = sum + n;
txt += n + " ";
}
document.write(txt + " is <B>" + (sum/5) + "</B>")
</script>
</body>
</html>
