By Team Escalera
on 31 Oct 2017 03:02 PM
  • asp.net training, C Sharp Training
0 comments

Let’s consider this example to understand the Usage of AND operator. AND operator is written as ‘&&’ two ampersands. It is used for getting results only if all the conditions are true , all the conditions are separated by && operator.

int age = 55;
double salary = 540;
if(age > 18 && salary > 100) {
Console.WriteLine(“Welcome User”);
}

Here we declared age as 55 and money as 540.

Now if Both the Conditions i.e Age > 18 and Salary > 100 are true then only Welcome User shall be printed.

Else we can show some other result or message.

Comments (0)

Leave A Comment