Examveda

What will be the output of the following C# code?
public static void Main(string[] args)
{
    int a = 4;
    int c = 2;
    bool b = (a % c == 0 ? true : false);
    Console.WriteLine(b.ToString());
    if (a/c == 2)
    {
        Console.WriteLine("true");
    }
    else
    {
        Console.WriteLine("false");
    }
    Console.ReadLine();
}

A. TRUE
FALSE

B. FALSE
TRUE

C. TRUE
TRUE

D. FALSE
FALSE

Answer: Option C


Join The Discussion

Related Questions on Operators and Expressions in C Sharp