How to print 1 to 100 numbers using loop in asp.net

In this article I am going to explain how to print 1 to 100 numbers using loop in asp.net

Implementation:

C# code:
  protected void Page_Load(object sender, EventArgs e)
    {
        for (int i = 1; i <= 100; i++)
        {
            Response.Write(i + "<br/>");
        }

    }

VB.net code:
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        For i As Integer = 1 To 100
            Response.Write(i.ToString() + "<br/>")
        Next

    End Sub

Post a Comment

0 Comments