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
Whoo hoo!
So we are back and in this exercise, what we have to do is to like to get some seconds into to calculate
and to preen the following result, just like these clock hours, minutes and finally the remaining
seconds.
So we've seen one example on their presentation and we said that that basically we will simply receive
seconds.
So in seconds and then we are going to read these seconds from the users.
So intersections, right.
Then releasing information and store it inside.
Variable seconds.
Seconds.
Yay!
OK, so, yeah, that's good.
And now what we have to do is simply to do the following.
So what is it?
What do we have to do now is like let's do it, let's, let's do it, let's do it like this.
So what we need to understand is, first of all, let's decompose kind of decompose the seconds into,
let's say, hours, minutes and remaining seconds, which is pretty much just what we've used previously
in our previous examples in the previous section, I guess.
So in this case, let's use our minutes, remaining seconds.
So erm let's calculate them.
You remember how to calculate the hours.
You simply take the total seconds.
Let's just call it once again total ten seconds.
So you take the total seconds and you divide it by you divide it by thirty six hundredth.
Since we know that there is thirty six hundred seconds in a given hour and it will give us the total
amount of hours that we have in this representation to fool hours.
And all right.
Afterwards you can calculate the minutes to remember the full explanation to why we counted using the
total seconds, minus hours multiplied by three.
Sixteen three.
Sixty three.
Thirty six hundred.
Sorry for that.
That's a little bit tired now.
OK, I'm just recording a lot of exercise during the day and it's already evening.
So sorry for that.
So total seconds minus hours multiplied by thirty six hundred and this will give us the remaining,
the remaining seconds that are left.
OK, so total seconds minus the seconds that were taken into consideration by using these hours variable
and all of that divided by 60 because we know there are 60 seconds in a given minute.
All right.
So finally, all that remains for us to do is to calculate the total seconds.
So remaining remaining seconds equals to the total seconds, minus hours multiplied by three six three
thirty six hundred and all of that.
We know that that's the seconds remaining and we know that we can calculate the remainder simply by
using remainder of six sixty and it will give us the total remaining seconds.
OK, so the main logic behind it, I'm simply not going to get into all the details right now because
we talked about it in the previous exercise, in the previous section.
So I think, yeah, that's OK.
And now all that remains to do is not simply to use the following line that what that wouldn't work,
OK?
So percentage D percentage and percentage there.
Now let's use fewer hours minus the minutes and remaining seconds.
OK, so let's try to build and run it and see what will happen.
So go here, build and run.
What is the problem.
Can F doesn't work here.
What is the problem.
What kind of percentage.
The seconds.
So let's see, let's see.
What's the problem.
Seconds is undeclared.
OK, so seconds is undeclared.
No problem at all because we changed the variable name to total seconds so yeah that should be it.
Let's build and run it.
So anthracyclines, let's go with 4000 like we had in the sample, and we will see one 640 and while
that's true, there is one hour, six minutes and 40 seconds in this time.
The problem is that we were requested to print the time in the following format, like our hour, minute,
minute, second, second.
So it should be just the two digits representing the hour and two digits representing the minute.
So that's the main note that I said.
And I told you in the presentation when where I showed you the the exercise itself.
So that's something that we also need to take into account.
So this approach of just printing, you know, like however you like, won't work.
But what we need to understand is that hours, these variable may be of one digit and also it may contain
two digits.
And the same goes for the minutes and also for the seconds.
Right.
So in this case, we need to understand that.
And if we know that hours or minutes or remaining seconds have just either of them has just one digit,
then in this case we should add the the digit of zero beforehand.
So, for example, we had something like this.
Right.
Like inves example.
Then in this case, we will we we see that the hours it has just one digit.
Then in this case, we need to do something like this zero one.
OK, and then we notice that the minutes also has one set, one minute one digit, and we should do
something like this.
Finally, for so that these representation will be will correspond to this one.
All right.
So for that, what do you think should be done?
OK, there are many additional approaches to solve this exercise, but one of the best approaches,
in my opinion, is simply to check if a given condition, if a given condition, if a given variable
is just one digit or two digits, more so on.
So if it if it's just consists of one digit so we can check the following condition if ours is less
than 10.
OK, and if that's the case, if ours is less than 10, then we know for sure that it will probably
be OK.
If we assume that ours is from zero to to 12, it should be right over to 24.
Then we can say that if ours is less than 10, then in this case we will print, OK, we will simply
print zero without a new line, without anything.
So that's what we've done.
We simply printed out here with printed let's go like this.
So we printed zero.
OK, and what should we print next.
OK, what do you think we should print next.
Next we should print print F percentage the OK and column and ours.
So what we've done here.
OK, what do, what do we do here.
So we said let's print zero and then let's print ours.
So in this case it's one and it's looking ok.
OK, I see you see what we're doing here.
So the question is what was what, what should we do if the hours was like, I don't know, 12 or 11,
let's say that's that's the hour, then in this case, we simply would have gotten a false result on
this condition and we simply would not print the zero.
We would just go and print the hours, which in this case will be just 11 minutes.
Also something that we wanted to do.
That's part of the exercise.
OK, so I hope that's clear.
This printing of cigarroa and the same approach, we are going to do four minutes.
So if minutes is less than 10, right.
Because we want to know if it contains just one digit.
So we that's the case.
Let's print once again zero.
OK, so if that's the case, we print zero.
And if the minutes wor I don't know, like 50, then there is no need to print.
There is no need to print zero.
Then we just could have printed 50.
But in this case we also print out percentage, the right percentage and just like this.
OK guys, so we print the minutes right afterwards and call in here.
OK, so we are almost done.
And finally we have to check the remaining seconds as long as it's less than ten.
OK, one digit.
And in this case, also print zero.
And finally print out.
Print F percentage the.
And no, there is no need for that, just a backslash and at the end of it and you know, OK, what
happened here?
OK, awesome.
So, yeah, and here specifically, the remaining seconds and the.
Yeah, I think we are done right.
Let's remove these part.
This part is not necessary for us anymore and also we can remove this part.
So that's the main, let's say, logic behind the solution of this exercise, simply understanding that
we can use conditions as part of the printing operation.
Let's just see what happens.
So anthracyclines four thousand.
Then in these kids you see zero one zero six forty.
So you notice of it.
For example, let's say, I don't know, fifty thousand.
I don't know what it was.
Thirteen, fifty three.
Twenty.
OK, so you see that if any of the variables, hours, minutes or seconds is not less than ten, then
this following line, these following command of printing zero in the corresponding spot will simply
not be executed.
So here I think this is easy for these video guys.
I hope you liked it.
Let me give you some review or some feedback if you want me to continue making these exercises and also
your overview review of these scores so far.
So until next time, keep on practicing and we will meet again.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.