Write a JavaScript program using while statement to find out the sum of first n numbers.
<html>
<head>
<title>Sum of fist n numbers</title>
</head>
<body>
<script>
var i = 1;
var sum = 0;
var n = parseInt(prompt("Enter upto which u want to find sum of numbers"))
while(i <= n)
{
sum = sum + i;
i++;
}
document.write("Sum of first " + n + " numbers : " + sum);
</script>
</body>
</html>
