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
So what we want to do this exercise is to write a program that will receive some value, write value,
and these programs should print the absolute value of this given number.
So let's start then create our first variable and only variable for this exercise.
And it's going to be, let's say, no.
OK, so tandem.
Then we are going also to read the value from the from the user and enter integer, whether it's true,
whether it's positive or negative, positive or negative.
OK, so either it's positive or negative and then the user is going to insert this number.
We are going to use it to read it using this kind of function and store it inside now and now we are
ready to make our basically logic and the main part of this exercise thing that we want to do.
So we have num and num, maybe either positive or negative.
Right.
Just like we've seen in the examples before, and we want to print the absolute value.
So what do you have to do is to think about these two options?
OK, two scenarios.
The first scenario is either the number is negative or the number is positive.
And what differentiates between two of these scenarios, the question is very the answer is very simple.
It's just these conditions.
So if num if num is less than zero, Phnom is less than zero, then in this case we know that the number
is probably negative.
Right then in this case, what we should do is simply to print out, OK, the absolute value, the absolute
value of the percentage of num ease its use here.
Also percentage be then in this case, that's what we will have.
So instead of the first percentage placeholder, what we will use is simply.
And instead of the second percentage, since we know nothing is negative, for example, let's say minus
three, then in this case we should multiplied by minus one.
And if we do so, we know that minus multiplied by minus gives us final result of plus is correct.
So we simply take minus one and multiply it by now.
That's it.
So whatever value num had at this point or gave this condition is true.
It was definitely negative and if we multiplied by minus one then we turn it into some positive value
and we can represent it is the absolute value of num so awesome.
But if the result was false for this condition, then we know that the number itself is positive.
So that now what we can do is simply print this message.
The absolute absolute value of percentage is percentage.
And in both of these cases we will use none and none without multiplying it by any other number.
So very simple, just taking of a given number, checking if it's positive or negative and if it's negative,
multiplying it by minus one and if it's positive, multiplying it by nothing.
OK, so simply that's how it's going to work.
So let's build and run it and let's see what happens if we insert five.
So the absolute value of five is five and if we will use like minus 17, then the absolute value of
minus 17 is 17 since we multiplied it by minus one and that's it.
So yeah, I think that everything is clear in this video.
If you still have any questions, feel free to ask them in the questions sections.
And until next time, have a great day.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.