<%
option explicit
dim n, sum
n = 1
do while (n <= 10)
sum = sum + (n * n)
n = n + 1
loop
response.write (sum)
%>
The output on this code is 385.
I understand that we gave n the value of 1,
then the do while states execute while n is less than or equal to 10
then sum has the value of sum plus (n times n)
n is then has a + operator of 1
loop this until n is no longer less than of equal to 10
then output the sum 385
I don’t understand how this we get this output.
1 Answer