In
this article I am going to explain how to display odd numbers between 1 to 100 in
asp.net
Implementation:
C#
code:
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 1; i <= 100; i++)
{
if(i%2==1)
{
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
If i Mod 2 = 1 Then
Response.Write(i.ToString() + "<br/>")
End If
Next
End Sub
0 Comments