All language subtitles for 5. Function Example 2 - Print Max between 2 Integers

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

Welcome back, ladies and gentlemen, and this is another exercise where we are going to practice our

function skills in C programming language.

And in this exercise, what we are going to do is we are going to write a function that receives receives

two numbers.

It receives two numbers.

And then all it does is simply to print out, to print out which one of them is the maximum print out,

which one of them is the maximum so maximal and which one of them is the minimum.

So, for example, if we will have if we will have, let's say nine one equals two five and two equals

two seven.

So in this case, with the function is going to print maximum equals to seven.

Right.

And minimal meaning more equals two.

Five.

That's it.

So if we come to think about this function, about what will be Stipe, we can see that this function

does not return anything, although these function prints something to the screen, prints the maximum

preens at the minimum.

It doesn't matter because we do not see anything that related to the return statement.

The function will be the arm of type void.

Right.

And then we are going also to specify the function name.

So for this example, it's a print mean marks.

Please remember that it's very important to give your function name.

Something useful, something meaningful that will describe the content, the meaning of the function

when the function does.

And right after work, we are going to specify the parameters that the functional will receive.

So we can see here that the functional receives two numbers.

So two numbers, let's say, of an integer, a type.

So we can use something like this into one and into number two.

And at this point, we know that the function received everything that is needed.

And now we are going to write the functions body in these curly brackets.

So the function actually is pretty simple.

First of all, you just ease a condition.

So you just go something like this.

If no one is greater than NUM two, then in this case you are going to do the following.

You are going to print to the screen that the maximum.

Between these two number.

Between these two numbers is the percentage D backslash shann.

And in this case, it will be simply No.

One, right.

Because it's greater than NUM two, meaning it's the maximum, obviously.

So this will be number one.

And similarly, we are going to do it for the minimum between these two.

We know that if if that's the maximum.

Then of course, this one will be less than num one.

So we are going to write down.

Minimum is percentage and just change it from num one to num two.

All right.

Very good.

Now, what we have to do is simply to specify the else statement, meaning if no one is not greater

than two.

Then what we are going to do is we are going to execute these block of code.

So in this case, the print F commands are going to be very, very similar.

Where will we were just going to copy them?

So we are going to do something like this, bring def maximum is it.

And accept.

And instead of this percentage which is used for nowon, we are going to use them too.

And here we are going to use now one for the minimum rate because this else section is only executed

if num two is at least Rayder or equals two now one.

So in this case we will assume that NUM one is the maximum.

Right.

It's at least equals to num one or greater than one.

Here are the minimum we use num one.

So simple is that.

And one thing I want you to notice is that this function, this function Brint mean marks.

This function does not return anything.

You can see that there is no line like this return.

No.

Minimal.

More turned maximum or something like that.

We do not return anything.

And the reason is because these function, these functions of type void and it shouldn't return anything,

just should print something to the screen.

So, you know, the difference between printing and returning something to the calling function.

Right.

And there you go.

Whiskery can say that.

Let's remove these two lines.

We can say that the print mean marks function is over.

We we are done with it.

Now, what interest us sees to write are the main function in to see how we call this printing marks.

So that's actually very simple.

Let's just use int A and B, we create two variables, A and B, which are a local to these main function.

Right.

We can not access them, at least at least at this point we cannot access them.

Through these functions, so these a ANP are local to the main function.

And now we are going to write a print.

Please enter number one and number two.

So print f Panter num number one.

Right.

This will go for R for the A..

So now we are going to use the scanner percentage, the story inside the first variable.

And similarly, we are going to do the same for the second variable.

So just use print F and enter number two.

And now you are going to use the scanner F to really attan percentage B.

And that's set.

Now, what you are going to do is simply simply call this function, right.

We have already two numbers, two variables, and we want to find out which one of them is the maximum.

In which one of them is the minimum.

So in this case, we will simply call the function we know that we can call X function just by specifying

its name.

So print mean marks.

All right.

So there you go.

Print mean marks, print mean marks.

And in the parentheses, we are going to specify what these function will receive as a parameter.

So that's the first parameter in.

Number one in NUM one, we are going to send the value of a and for now two.

Here you can see it.

We are going to send the value of B and at the end of course, specified the semicolon.

And now let's try to build and run it and see what happens.

So here we go, enter nine one.

So as we've using our example, five and seven.

So there you go.

There you can see it.

Maximum is seven and minimum is five.

And we can try another example.

Let's run it.

Let's do something like this.

A hundred and 5000.

So 5000 is obviously the maximum.

This case in one hundred is the minimum.

So I hope this example is clear.

Basically, what we've done here is we've written a function of type of off a void type, receiving

two parameters and running some commands.

Some conditions and some printing to the screen commands with messages of maximum and minimum.

So there's need for this video, guys.

I hope you enjoyed it.

And we are going to proceed with the third one.

I'll see you there.

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