Hi guys.
Welcome back.
In this tutorial we're going to discuss several logical operator ascendancy.
Okay.
An expression containing logical operator it's either 0 or 1 depending on whether expression is as true
or false.
The logical operators are commonly used in decision making and these are the logical operators which
are available in C.
This one is called S and Anderson coordinates all.
And this one does not.
Okay so.
And it will return true if we leave all our prints are true.
Whereas logical returns true if any or not.
If if anyone of the condition is met and not operator returns true or leave the operant is zero.
Okay so we will discuss in detail with the help of a program.
These are not the basic sample program for logical operators.
Okay we'll see one by one.
I to use and are not.
Okay so here I have three variables reserved.
C D and I have initialized two values 5 on 2 for C and D respectively.
Okay so here what I'm doing is like I'm trying to use the end operator.
So here I'm just putting it to condition C equal to D and C's get that into.
Okay.
Is fine.
Okay.
These two so obviously C is not equal to the.
Okay.
And C is greater than the.
Okay.
This is true but in an operator if both conditions are true then only intermittent 1.
Otherwise it should return 0.
So he had one condition is considered this condition is well.
So it didn't zero if both conditions are true then later the written one.
Okay so now so the output of this should be zero.
So I'm just right I just want to print off shipment here.
So in order to capture the result of this condition so it should return 0.
We'll see later during the combination.
So now I'm we can see under our operator so aren't means like for example I have two conditions here.
If any one condition is met okay it will return to work.
For example if we see here C equal to do sorry C equal to be so which is false because he's going to
quantifying that us under these two.
So we just force.
Okay.
But the second condition for C here C is greater than D.
So which means fine is that too.
So we just do so in case of all an operator if any one condition is met.
Then this this will return.
OK so this output.
OK.
So when I printed here it should show as it should retain the values one.
OK so now this is the final end.
Let's call it the Not operator.
So it's very simple.
If this condition returns zero.
Okay.
Which was false.
Then this will ring true.
Okay.
Not upper level for example the C hit sequel to fight.
We just phase equal to B.
I mentioned as VI equal to do we just fall actually because these going to do and you qualify but an
unequal under scrutiny.
Zero.
So you've seen this is zero.
And because of this not operate that this will become one.
Okay.
So when I printed on a printer it should show us one.
Okay so now let me compile and see what happens.
Okay see here.
So again I'm explaining here one condition is false.
Which is as he called it is false.
Sam but this condition is true.
But but for this and operator Butch both conditions should make a dent a little dated one which is to
cohere since one condition is fortitude and zero.
So he's a different zero here.
Okay.
So then the second one if anyone second second one is our operator if any one condition is met then
it'll return true.
Okay.
So here since this condition is true.
So then why.
Okay.
So it is not operator it returns too early.
If the operator is zero.
So if you see here see equal to this condition is falls short in 0 8.
So because of this our operating not operator.
So this output will be 1.
But if this is true then this indigenous force okay for example we'll see what happens.
No lower the condition here is C is greater than D which means that fire is greater than 2 which will
see a fight and the equal to 2.
So fire is not ready to fight is greater than that.
So this condition is true and because of this not operator intermittent
OK singing never repeating cease fire.
Nicole to do so fight is greater than.
The condition is true because of this not operator.
It will work.
It will print false which is zero.
So this competency what happens is the build and run of the you know the police.
Zero.
So soon this condition is true because of this not operate that it'll print as zero which means fast.
Okay.
Zero it's false.
Okay so this is how the logical operators works in C programming language.
Thanks for watching this video.
I'll catch you guys in the next session.
Bye for now.