ExamVeda
Login
Home
Arrays and Strings in C Sharp
?

What will be the output of the following C# code?
class Program
{
    static void Main(string[] args)
    { 
        String []chars = {"z", "x", "y", "z", "y"};
        for (int i = 0; i < chars.Length; ++i)
        for (int j = i + 1; j < chars.Length; ++j)
        if(chars[i].CompareTo(chars[j]) == 0)
        Console.WriteLine(chars[j]);
        Console.ReadLine();
    }
}

Answer & Solution
Correct Answer: Option C
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.