ExamVeda
Login
Home
Classes and Objects in C Sharp
?

What will be the output of the following C# code?
static void Main(string[] args)
{
    int []a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    func(ref a);
    Console.ReadLine();
}
static void func(ref int[] x)
{
    Console.WriteLine(" numbers are:");
    for (int i = 0; i < x.Length; i++)
    {
        if (x[i] % 2 == 0)
        {
            x[i] = x[i] + 1;
            Console.WriteLine(x[i]);
        }
    }
}

Answer & Solution
Correct Answer: Option B
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.