All language subtitles for 7. isEven Function C Exercise

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

What is going on, guys?

And in this video, we are going to solve some exercise regarding functions and we will start with a

very simple function that is called let's call this function is even so, that's the name of the function.

All right.

So that's the name of the function.

And what you have to do is to simply implement it, first of all, to define its signature, then to

write all of its implementation.

And all these function basically does is simply receiving.

OK, so this function will receive will receive an integer, some number of an integer, a type.

And this will this function will will return one if this given number is even OK.

Otherwise this function should return, these function should return.

What you need to return should return zero.

OK, so in case that it's all OK that the received number is odd, then in this case the function should

return basically zero.

Awesome.

So now take a couple of moments and think about what should be the solution for this function.

What should be should be its signature.

What type should it return?

What will be the name of the function?

OK, most of this information is already there in the instructions of this exercise.

So let us start with the the signature, OK, once you tried it on your own and the signature is going

to look like this.

So first of all, we know that the function may return either zero or one.

So we can assume, OK, in base case because we haven't studied boolean boolean types yet.

So we will assume just the usage of it.

OK, so the function will return an integer.

So either it will be zero or one and then it will specify the function name.

So it will be like is even in the function receives.

What does the function receive.

The function receives an integer.

So let's go into num.

OK, so that's the signature and that's the first step that hopefully you manage to accomplish so far.

And now we have to implement kind of the logic behind this function.

And the logic here is pretty simple.

So it goes like this.

We need to ask a simple question.

If NUM is an even number then return one, otherwise return zero.

So we should basically understand the idea in English.

But whatever language you're using, you're speaking, but here we speak in English, so now basically,

you know what you have to do in practice, but now what you have to do in coding.

So you have to specify the if and then you have to specify the number modulo two, which means that

this will represent the remainder of dividing the value of NUM by two.

If the remainder is zero, then in this case we know that number is an even number, then in this case

we will return one.

All right.

Otherwise, otherwise, ok, we can use or or else we can return to zero.

All right.

Is that clear so far.

Awesome.

So that's basically the implementation for this function.

OK, so this Ale's will be executed only if the result for this condition is false, meaning that if

you divide number by two, you will get a remainder of one, meaning it will be an odd number.

So one question.

Do you think we need this L's here?

I don't think so.

I think we can even leave it like this.

And why will it still be working?

Well, basically, if you return one, then it's kind of an end point for this function and it will

never reach this return zero.

It will only reach this line, these 13 line only if the result of this condition is false, because

if the result of this condition would happen to be true, then in this case this line would have been

executed.

And we know that we can leave it this way.

Of course, if you would have written the else, that's also fine.

I'm just showing you how we can simply like to how we can minimize a few lines of code in this case,

just one line of code.

So, yeah, guys, this is it for this video.

In the next video, I think we should practice and do the same function for is odd and we will use.

Hmm, yeah, basically, let's discuss it in the next video where we are going to solve another function.

I'll see you then.

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