Equal To (==) and Not Equal To (!=) operators are used for comparison, they are used to compare two operands and return Boolean value.
Equal To (==) operator returns True – if both operand's values are equal, else it returns False.
Not Equal To (!=) operator returns True – both operand's values are not equal, else it returns False.
Syntax:
Operand1 == Operand2
Operand1 != Operand2
Example:
Input:
int a = 10;
int b = 3;
Console.WriteLine("a==b: {0}", (a == b));
Console.WriteLine("a!=b: {0}", (a != b));
Output:
a==b: False
a!=b: True
C# code to demonstrate example of Equal To and Not Equal To operators
Output
need an explanation for this answer? contact us directly to get an explanation for this answer