5. 5
PROGRAM 3
1. <html>
2. <head>
3. <title>odd and even</title>
4. </head>
5. <body>
6. <% for i=1 to 10
7. if(i mod 2=0) then %>
8. <b><%response.write(i)%>is even</b>
9. <br>
10.<% else %>
11.<b><%response.write(i)%>is odd</b>
12.<br>
13.<% end if
14.next %>
15.</body>
16.</html>
6. 6
PROGRAM 4
1. <html>
2. <head>
3. <title>factorial</title>
4. <% sub fact(n,f)
5. f=1
6. for i=1 to n
7. f=f*i
8. next
9. end sub %>
10. </head>
11. <body>
12. <p>
13. <% dim n
14. call fact(5,n)
15. %>
16. the factorial of 5 is <% response.write(n)%>
17. </p>
18. <p>
19. <% fact 5,n%>
20. the factorial of 5 is <% response.write(n)%>
21. </p>
22. </body>
23. </html>
10. 10
PROGRAM 8
<% dim numvisits
response.cookies("NumVisits").Expires=date+365
numvisits=request.cookies("NumVisits")
if numvisits="" then
response.cookies("NumVisits")=1
response.write("Welcome! This is the first time you are
visiting this Web page.")
else
response.cookies("NumVisits")=numvisits+1
response.write("You have visited this ")
response.write("Web page " & numvisits)
if numvisits=1 then
response.write " time before!"
else
response.write " times before!"
end if
end if %>
<html>
<body>
</body>
</html>
11. 11
PROGRAM 9
1. <html >
2. <head>
3. <title></title>
4. </head>
5. <body>
6. <h1><% session("username")="suha"
7. session("age")=50
8. response.write("welcome..... ")
9. response.write("<br>")
10.dim x
11.for each x in session.contents
12.response.write(x & ":" & session.contents(x)&"<br/>")
13.next
14.%></h1>
15.</body>
16.</html>