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
All right, so now once you've given it a try on your own, let's solve this exercise together.
So first of all, we know that the function does not return anything.
So it's going to be a fee void type.
So void.
And now we will specify the function name, let's say Marks Legia.
Right.
Because we find out what is the maximum digit between the digits in a given number.
And of course, we are going to receive as a parameter in other a number.
So in Nahm and now we are going to specify the functions body so the body will have to check out some
condition to make sure that the number E has only two digits.
And one way to do it is to use condition like this.
So we know that all the numbers that have two digits are in the range between 10 and 99.
Right.
Something that is less than ten is contains only one digit.
And something that is above some number that is above 99 contains three numbers at least.
So we are going to write a condition that will check this out.
So if NUM is greater than 99.
Okay.
Let's do it.
This is greater than ninety nine.
Meaning it has three digits or.
Or.
Right.
We are going to use this logical operator to see if another condition may happen.
So if NUM is less than 10, which means that we have only one digit.
So if that's the case we are going to print out a corresponding measure message.
The number, the number is not a two digits number.
Please try again or something like that.
Is that clear?
And now what we are going to do is to specify the L section, which means here are all the interesting
stuff that is going to happen, will be here.
So we want to check out if we have two digits number meaning the number itself.
He has X and Y, let's say X is a digit.
And why is it digits?
Right.
For example, let's say thirty five.
So three is a digit is the left digit than five is the right digit.
So we need to compare between these two digits.
And one way to do so is simply to compare the remainder that you will get.
If you divide the number by ten.
So if you do it like this, you will get.
What is the remainder would be if you divide thirty five by ten.
So if you divide thirty five by ten, you will get three.
Right.
Meaning three times you have multiplied by ten will give you 30.
So the remainder in this case will be just five.
So these division, the remainder of by when you divided by ten will be just five.
Right.
Which give you and which gives you the right digit in these two digits number.
So you compare this one to number divided by ten which gives you.
Which is simply the left digit.
Right.
If we said that we divide thirty five by ten in the full day vision like we can see here will you.
Just three which is the left digit.
So that's how you find out the right digit.
And that's how you find the left digit in a number with two digits.
So if that's the case then we know that the right digit is greater than the left digit.
And in this case, we are going to print out the at the maximum maximum digit in percentage.
The number itself we are going to specify it is percentage.
And instead of the first percentage of the.
We're going to specify.
And in the second percentage, would B, we are going to specify the right digit.
The right digit between the two and the L section is pretty, pretty and pretty much the same.
Because we know that if the left the right digit is not greater than the left, then meaning that the
left is at least equal to or greater than the right.
So we are going to copy and paste this line, this line right here.
And instead of nine divided with the remainder, we are going to divide it just by 10.
And that's basically it.
That's the whole exercise.
A try to summarize it and to make it a little bit faster than the previous ones.
So let's write the main section and make sure that the program works.
OK, so let's test it out just by using mongst digit four thirty five.
And let's see what will be printed out to the screen.
So build and run it.
Let's build and run it.
And we can see that the maximum digit in thirty five is five.
We do another example, let's say 98, whoops, sorry about that.
Let's build in a running once again.
Oh, sorry, sorry, sorry.
We should just modify it here.
So 98.
We are going to see it right here.
OK.
So 98, the maximum digit is nine, of course.
And we can see that a program works, that the function works as expected.
You could write longer are more accurate.
Let's say main program.
Just be reading the value from the user as we've done in the previous challenges.
But that will also be OK for now just to make sure that the function of works.
So to summarize, what we've done here is we simply received a number make made sure that this number
has contains only two digits.
And then we compare at between the right digit.
This is the right digit.
And this is the left digit and printed out a corresponding message based on the result of these conditions.
So thank you guys for watching Gehlen.
I'll see you in the next challenge.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.