adplus-dvertising
frame-decoration

Question

What will be the output of the given 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

Posted under C# programming

Answer: (b).3

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the given code snippet?