Examveda

What will be the output of the following C# code snippet?
class Program
{
    static void Main(string[] args)
    {
        int[] nums = {3, 1, 2, 5, 4};
        var ltAvg = from n in nums
                    let x = nums.Average()
                    where n < x
                    select n;
        Console.WriteLine("The average is " + nums.Average());
        Console.ReadLine();
    }
}

A. Run time error

B. 3

C. 5

D. Compile time error

Answer: Option B


Join The Discussion

Related Questions on LINQ (Language Integrated Query) in C Sharp