Display odd numbers in an array using LINQ

Ddd
Posted by Ddd under LINQ category on | Points: 40 | Views : 3942
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication20jan
{
class Class6
{
static void Main()
{
int[] arr = { 10, 20, 25, 27, 30 };
var q = arr.Where(a => a % 2 == 1);
Console.WriteLine("odd numbers");
foreach (var h in q)
{
Console.WriteLine(h);

}
}
}
}

Comments or Responses

Login to post response