All language subtitles for 16. Logical Operators in C Programming Language

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,450 --> 00:00:02,280 Welcome back, ladies and gentlemen. 2 00:00:02,370 --> 00:00:09,960 Now, this video, we are going to take a look at how logical operators may be used in our C programming 3 00:00:10,110 --> 00:00:10,650 language. 4 00:00:10,680 --> 00:00:12,540 So logical operators. 5 00:00:12,570 --> 00:00:14,010 Here we go. 6 00:00:14,130 --> 00:00:22,110 We are going to start with our previous example, which says if we got 90 or higher on our last exam, 7 00:00:22,140 --> 00:00:23,400 so let's write him down. 8 00:00:23,490 --> 00:00:36,900 If we got 90 or higher on our last exam and and if we also have less than 50 bucks, if we have less 9 00:00:37,110 --> 00:00:43,620 than 50 bucks in our wallet, then this case we can ask for some money. 10 00:00:43,830 --> 00:00:45,570 Pretty nice example, don't you think? 11 00:00:46,350 --> 00:00:53,610 So we've seen the logical structure behind it as well as the truth table behind the and logical operator. 12 00:00:54,290 --> 00:01:00,370 And now we want to take a look at how it can be read them in our language. 13 00:01:00,780 --> 00:01:05,600 So that's not a basically failed state man that we've seen in our previous examples. 14 00:01:05,600 --> 00:01:05,900 Right. 15 00:01:06,450 --> 00:01:12,720 Let's first of all, pronounce this condition correctly by specifying the exact two sub conditions, 16 00:01:13,380 --> 00:01:20,190 these two operations we can see right here and then construct a general condition by using the logical 17 00:01:20,220 --> 00:01:20,970 operator. 18 00:01:21,450 --> 00:01:27,390 So the first condition is if we have less, if we have less, let's say that this the first condition, 19 00:01:27,780 --> 00:01:30,990 if we have less than 50 bucks in our wallet. 20 00:01:31,350 --> 00:01:38,310 And and the second condition is if we got 90 or higher in our last exam. 21 00:01:38,460 --> 00:01:46,860 So when we pronounce it this way, we can hear that there is this and there is this and it which appears 22 00:01:46,860 --> 00:01:48,900 between both of these sub conditions. 23 00:01:48,900 --> 00:01:49,320 Right. 24 00:01:49,770 --> 00:01:50,340 And this. 25 00:01:50,400 --> 00:01:55,170 And Worthy's called the logical operator, which you already know this much. 26 00:01:55,170 --> 00:01:55,410 Right. 27 00:01:55,450 --> 00:01:57,140 I'm just just a quick reminder. 28 00:01:57,300 --> 00:02:01,600 So if you want to construct some new condition, it will look something like this. 29 00:02:01,650 --> 00:02:01,910 OK. 30 00:02:02,010 --> 00:02:04,200 So let's say that we have two variables. 31 00:02:04,230 --> 00:02:12,130 So let's say there is money and there is in grade at grade writing in grade and we use some messages. 32 00:02:12,200 --> 00:02:16,830 So enter enter money and grade. 33 00:02:16,980 --> 00:02:17,440 OK. 34 00:02:18,210 --> 00:02:19,260 Very simple. 35 00:02:19,560 --> 00:02:23,030 Then we use a scanner function to read these values from the user. 36 00:02:23,090 --> 00:02:28,710 So percentage of the percentage there and we used here the money and the grade. 37 00:02:29,280 --> 00:02:30,570 Nothing special so far. 38 00:02:30,840 --> 00:02:33,390 Now if we want to ask the condition. 39 00:02:33,480 --> 00:02:34,890 So we ask it this way if. 40 00:02:35,280 --> 00:02:35,610 OK. 41 00:02:35,660 --> 00:02:36,780 So they each statement. 42 00:02:37,170 --> 00:02:40,680 And then we have money is greater. 43 00:02:40,800 --> 00:02:41,820 It is less. 44 00:02:41,940 --> 00:02:43,470 It's less than 50. 45 00:02:43,560 --> 00:02:43,860 OK. 46 00:02:43,920 --> 00:02:46,340 So if this condition. 47 00:02:46,400 --> 00:02:49,140 This operand is true and right. 48 00:02:49,170 --> 00:02:50,910 We need to specify something like this. 49 00:02:51,000 --> 00:02:55,760 And grade is greater than 90. 50 00:02:56,070 --> 00:02:57,240 Then do something. 51 00:02:57,900 --> 00:02:58,620 Do something. 52 00:02:59,190 --> 00:03:03,260 So this and here will not work in C language. 53 00:03:03,270 --> 00:03:03,570 Right. 54 00:03:03,660 --> 00:03:04,650 So instead of this. 55 00:03:04,740 --> 00:03:08,420 And in C we use the double ampersands. 56 00:03:08,490 --> 00:03:10,530 So simply using this way. 57 00:03:10,770 --> 00:03:15,420 And it's equivalent, as you would have said in your language. 58 00:03:15,510 --> 00:03:19,020 And so we use the double ampersands to indicate that. 59 00:03:19,080 --> 00:03:21,900 If and only if both of these conditions. 60 00:03:22,380 --> 00:03:23,760 Money is less than 50. 61 00:03:23,760 --> 00:03:24,060 Great. 62 00:03:24,060 --> 00:03:25,140 Is higher than 90. 63 00:03:25,290 --> 00:03:27,120 Only if both of them are true. 64 00:03:27,150 --> 00:03:30,900 The result of the condition of the whole condition will be true. 65 00:03:30,960 --> 00:03:32,550 And then we will do something. 66 00:03:32,550 --> 00:03:34,380 For example, ask for some money. 67 00:03:34,800 --> 00:03:35,610 Is that clear? 68 00:03:35,700 --> 00:03:38,940 So that's how you use the end logical operator. 69 00:03:38,970 --> 00:03:40,620 And now let's move on to see. 70 00:03:41,250 --> 00:03:46,260 How can we use the Aurora logical operator, which we've seen in our previous video? 71 00:03:46,260 --> 00:03:47,670 We talked about it in general. 72 00:03:47,700 --> 00:03:51,390 Now let's see how we can do it in our programming language. 73 00:03:51,420 --> 00:03:53,460 So it will look something like this. 74 00:03:53,610 --> 00:03:59,780 If money if money is less than fifty four or so. 75 00:04:00,130 --> 00:04:02,250 Logically, it will be like this. 76 00:04:02,670 --> 00:04:06,720 But since we are using our C programming language. 77 00:04:07,140 --> 00:04:08,550 This will be slightly different. 78 00:04:08,610 --> 00:04:13,680 And instead of this or word, we will use double vertical borrus. 79 00:04:13,710 --> 00:04:14,400 Just like this. 80 00:04:14,760 --> 00:04:16,230 So here you can see. 81 00:04:16,230 --> 00:04:21,260 And even if the condition happens to be true, then we will do also something. 82 00:04:21,270 --> 00:04:21,570 Right. 83 00:04:21,600 --> 00:04:25,410 I'm just showing you the difference between the end and the war in C language. 84 00:04:26,310 --> 00:04:29,940 So for the end logical operator, you use double ampersands. 85 00:04:30,210 --> 00:04:36,060 And for the or logical operator, you use the double vertical borrus. 86 00:04:36,210 --> 00:04:37,260 So this condition. 87 00:04:37,380 --> 00:04:39,250 This whole condition will be true. 88 00:04:39,420 --> 00:04:42,420 If either at least at least one of them is true. 89 00:04:42,450 --> 00:04:49,500 So if this sub condition is true or this sub condition is true, or if both of them are true, then 90 00:04:49,500 --> 00:04:51,170 the whole condition is going to be true. 91 00:04:51,240 --> 00:04:53,550 And we we'll we are going to do something. 92 00:04:53,970 --> 00:04:55,950 So that's something you can see. 93 00:04:56,280 --> 00:04:59,190 And you remember when we talked about the truth table. 94 00:04:59,250 --> 00:04:59,820 You can see. 95 00:05:00,310 --> 00:05:02,120 What what will be the result? 96 00:05:02,140 --> 00:05:09,340 Based on the status of the operands, so there is a truth table for each of these logical operators. 97 00:05:09,490 --> 00:05:16,410 And lastly, what we have is the not logical operator ending sea land, which is the logical operator 98 00:05:16,420 --> 00:05:20,650 not is specified as an exclamation mark. 99 00:05:20,680 --> 00:05:23,500 So it looks just like this, OK? 100 00:05:23,860 --> 00:05:25,420 It looks just like this. 101 00:05:25,480 --> 00:05:27,040 This bottom body here. 102 00:05:27,310 --> 00:05:29,590 This is the knot in C language. 103 00:05:29,680 --> 00:05:35,110 So if you put these exclamation mark before any condition, it will simply take the result, whether 104 00:05:35,110 --> 00:05:38,050 it was true or false and just reverted. 105 00:05:38,530 --> 00:05:45,370 So, for example, if we have the following condition, let's say if greyed is greater than 80, then 106 00:05:45,370 --> 00:05:50,200 print some nice message and print half a good job message. 107 00:05:50,250 --> 00:05:52,150 So good job. 108 00:05:52,980 --> 00:05:53,280 OK. 109 00:05:54,400 --> 00:06:00,040 So if this condition happens to be true, in rate is higher than 80, then you're going to run these 110 00:06:00,040 --> 00:06:00,580 command. 111 00:06:00,700 --> 00:06:05,770 But if you put an exclamation mark, let's say right here, I can add another parentheses. 112 00:06:05,900 --> 00:06:13,000 Then in this case, whenever a grade is higher than 80, the overall result that should have been through 113 00:06:13,120 --> 00:06:14,200 will be false. 114 00:06:14,320 --> 00:06:15,490 And vice versa. 115 00:06:15,550 --> 00:06:16,450 Simple as that. 116 00:06:17,080 --> 00:06:17,350 So. 117 00:06:17,500 --> 00:06:20,450 So now these good job will be executed only. 118 00:06:20,550 --> 00:06:20,850 OK. 119 00:06:21,250 --> 00:06:24,040 Because we used here the not logical operator. 120 00:06:24,520 --> 00:06:26,020 It will be only executed. 121 00:06:26,050 --> 00:06:29,940 One grade is less or equals to 80. 122 00:06:30,370 --> 00:06:34,600 So I hope you got the point of how the not logical operator works. 123 00:06:34,690 --> 00:06:36,430 You simply have a trial. 124 00:06:36,430 --> 00:06:42,100 And if the result of the condition is true and you put a knot on it, then it becomes false and vice 125 00:06:42,100 --> 00:06:42,550 versa. 126 00:06:42,780 --> 00:06:42,950 OK. 127 00:06:43,210 --> 00:06:47,830 So that's basically a very summarized tutorial regarding logical operators. 128 00:06:48,280 --> 00:06:55,000 Basically, all the operators, logical operator are saying relational operators like equality in equality 129 00:06:55,000 --> 00:06:56,520 more than less than. 130 00:06:56,580 --> 00:06:57,310 And so on. 131 00:06:57,940 --> 00:06:59,770 All of them are very important. 132 00:06:59,860 --> 00:07:05,800 And you need to know how to use them for almost all of our upcoming sections. 133 00:07:05,890 --> 00:07:07,830 So that's a lot of these video guys. 134 00:07:07,900 --> 00:07:09,340 Thank you so much for watching. 135 00:07:09,400 --> 00:07:11,270 And I'll see you in the next video. 11010

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.