What will be the output of the following C# code snippet? [code] class Program { static void Main(string[] args) { int[]

Như Quỳnh

New member
What will be the output of the following C# code snippet?
Code:
class Program
{
    static void Main(string[] args)
    {
        int[] nums = {1};
        var posNums = from n in nums
                      wheres n > 0 
                     select Math.Max(78, 9);
        Console.Write("The largest values in nums: ");
        foreach (int i in posNums) Console.Write(i + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}
A. Code runs successfully prints nothing
B. Run time error
C. Code runs successfully prints required output
D. Compile time error
 

Tìm kiếm

Back
Top