Generating odd numbers

Sandhyab
Posted by Sandhyab under LINQ category on | Points: 40 | Views : 1284
 protected void Page_Load(object sender, EventArgs e)
{
IEnumerable<int> oddNumbers = Enumerable.Range(1, 100).Where(x => x % 2 != 0);

foreach (int n in oddNumbers)
{
Response.Write(n + "<br/>");
}
}

Comments or Responses

Login to post response