Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Welcome back, ladies and gentlemen.
Now, this video, we are going to take a look at how logical operators may be used in our C programming
language.
So logical operators.
Here we go.
We are going to start with our previous example, which says if we got 90 or higher on our last exam,
so let's write him down.
If we got 90 or higher on our last exam and and if we also have less than 50 bucks, if we have less
than 50 bucks in our wallet, then this case we can ask for some money.
Pretty nice example, don't you think?
So we've seen the logical structure behind it as well as the truth table behind the and logical operator.
And now we want to take a look at how it can be read them in our language.
So that's not a basically failed state man that we've seen in our previous examples.
Right.
Let's first of all, pronounce this condition correctly by specifying the exact two sub conditions,
these two operations we can see right here and then construct a general condition by using the logical
operator.
So the first condition is if we have less, if we have less, let's say that this the first condition,
if we have less than 50 bucks in our wallet.
And and the second condition is if we got 90 or higher in our last exam.
So when we pronounce it this way, we can hear that there is this and there is this and it which appears
between both of these sub conditions.
Right.
And this.
And Worthy's called the logical operator, which you already know this much.
Right.
I'm just just a quick reminder.
So if you want to construct some new condition, it will look something like this.
OK.
So let's say that we have two variables.
So let's say there is money and there is in grade at grade writing in grade and we use some messages.
So enter enter money and grade.
OK.
Very simple.
Then we use a scanner function to read these values from the user.
So percentage of the percentage there and we used here the money and the grade.
Nothing special so far.
Now if we want to ask the condition.
So we ask it this way if.
OK.
So they each statement.
And then we have money is greater.
It is less.
It's less than 50.
OK.
So if this condition.
This operand is true and right.
We need to specify something like this.
And grade is greater than 90.
Then do something.
Do something.
So this and here will not work in C language.
Right.
So instead of this.
And in C we use the double ampersands.
So simply using this way.
And it's equivalent, as you would have said in your language.
And so we use the double ampersands to indicate that.
If and only if both of these conditions.
Money is less than 50.
Great.
Is higher than 90.
Only if both of them are true.
The result of the condition of the whole condition will be true.
And then we will do something.
For example, ask for some money.
Is that clear?
So that's how you use the end logical operator.
And now let's move on to see.
How can we use the Aurora logical operator, which we've seen in our previous video?
We talked about it in general.
Now let's see how we can do it in our programming language.
So it will look something like this.
If money if money is less than fifty four or so.
Logically, it will be like this.
But since we are using our C programming language.
This will be slightly different.
And instead of this or word, we will use double vertical borrus.
Just like this.
So here you can see.
And even if the condition happens to be true, then we will do also something.
Right.
I'm just showing you the difference between the end and the war in C language.
So for the end logical operator, you use double ampersands.
And for the or logical operator, you use the double vertical borrus.
So this condition.
This whole condition will be true.
If either at least at least one of them is true.
So if this sub condition is true or this sub condition is true, or if both of them are true, then
the whole condition is going to be true.
And we we'll we are going to do something.
So that's something you can see.
And you remember when we talked about the truth table.
You can see.
What what will be the result?
Based on the status of the operands, so there is a truth table for each of these logical operators.
And lastly, what we have is the not logical operator ending sea land, which is the logical operator
not is specified as an exclamation mark.
So it looks just like this, OK?
It looks just like this.
This bottom body here.
This is the knot in C language.
So if you put these exclamation mark before any condition, it will simply take the result, whether
it was true or false and just reverted.
So, for example, if we have the following condition, let's say if greyed is greater than 80, then
print some nice message and print half a good job message.
So good job.
OK.
So if this condition happens to be true, in rate is higher than 80, then you're going to run these
command.
But if you put an exclamation mark, let's say right here, I can add another parentheses.
Then in this case, whenever a grade is higher than 80, the overall result that should have been through
will be false.
And vice versa.
Simple as that.
So.
So now these good job will be executed only.
OK.
Because we used here the not logical operator.
It will be only executed.
One grade is less or equals to 80.
So I hope you got the point of how the not logical operator works.
You simply have a trial.
And if the result of the condition is true and you put a knot on it, then it becomes false and vice
versa.
OK.
So that's basically a very summarized tutorial regarding logical operators.
Basically, all the operators, logical operator are saying relational operators like equality in equality
more than less than.
And so on.
All of them are very important.
And you need to know how to use them for almost all of our upcoming sections.
So that's a lot of these video guys.
Thank you so much for watching.
And I'll see you in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.