Relational operators in C#


in C# and another programming languages ,we have to deal with many decision making problems.In C# we use Relational operator for solve decision making problems. In c# we have Six relational opertor.Today we well learn how to use these relational operator in C#

Relational Operators in C#


Relational operators used in C# for perform decision base manipulations.
comparing two numbers and deciding the greater number is done by Relational operator.Statement those containing relational operator are called relational expressions.
The value returned after evaluating a relational expression is either true or false.
Given bellow is list of relational Operators that use in C#:
1. < Is less than
2. <= Is less than or equal to
3. > Is Greater than
4. >= Is Greater than or equal to
4. == Is equal to
6. != Is not equal

Lets use these relational operator in a program


using System;
class Relational
{

public ststic void Main()
{

int x=20,y=30,z=19;
Console.WriteLine("x="+x);
Console.WriteLine("y="+y);
Console.WriteLine("z="+z);

Console.WriteLine("xConsole.WriteLine("x>y is"+(x>y));
Console.WriteLine("y!=z is"+(y!=z));
Console.WriteLine("y==x+z is"+(y==x+z));

}
}

OUPTUT OF THIS PROGRAM WILL BE:
x=20
y=30
x=19
xx>y is False
y!=z is true
y==x+z is False
Press any key to continue...


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: