<% @ language="VBScript" %>
<% Option Explicit %>
<html>
<body>
<%
Dim I,j
For I = 1 to 4
For j = 1 to I
Response.write I
Next
Response.write "<br>"
Next
</body>
</html>
Output:
1
22
333
4444
Please explain me how this output is formed.
![]() |
<% @ language="VBScript" %>
<% Option Explicit %>
<html>
<body>
<%
Dim I,j
For I = 1 to 4
For j = 1 to I
Response.write I
Next
Response.write "<br>"
Next
</body>
</html>
Output:
1
22
333
4444
Please explain me how this output is formed.
The program here works on the concept of Nested Loops which means a loop within a loop.
So, here loop 1 is For I = 1 to 4 within which is our loop 2 For j = 1 to i
The loops will be executed as follows:
- i will be assigned the value 1 as loop one begins thus, i = 1
- j also will be assigned the value 1, j = 1
- Then we enter the Response.write i
Next
Response.write "<br>"
Next
where value of i will be written. Thus the out put is:
1- The execution goes back to check the inner loop, where the limit is j = 1 to i. Since i = 1, the inner loop ends and the first looping of the first loop ends too.
- Now, we execute the first loop again, as i = 2.
- Again the inner loop is executed, this time j = 1
- The value of i is printed as 2
- The execution goes back to inner loop again, to satisfy the condition j = 1 to 2, j takes the value 2, thus j = 2
- The inner loop is executed again, forming the output
1
22- Same is followed of the values 3 and 4.
In nested loop, if the outer looping is say of 10 times and the inner looping is 5, the total times the outer loop is executed will be 10 times, and the total times the inner loop is executed will 5X10 = 50 times.
Thanxx Indya you saved my day..
How can I transfer the Text value of form to radio button on submit or on click
Not clear about what you are asking. I am assuming that you need to assign a user entered text value to a radio button.
Just use the text property of the textbox and radiobutton to do so.
radiobutton.text = textbox.text
All times are GMT -7. The time now is 11:56 AM. |