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 this exercise should be very easy and intuitive for you.
And actually, I hope that you get this video after you've tried to solve this exercise on your own.
You gave it a shot.
You tried to run some commands, even if that doesn't seem to be working out as you expected.
You tried to fix some bugs.
You tried to run these code once again.
And that's OK.
Don't be afraid of it.
That's how we learn, guys.
And now let's go over this solution together.
Basically, this exercise is pretty straightforward.
First of all, we need to understand first the difference, the difference between what is an odd number
and what is an even number and the rule to find it out is as follows.
Basically, if if the number.
All right.
If the number can be can be divided.
I'm writing eating the comments here can be divided by two without a remainder.
Without a remainder.
All right, then.
In this case, the number is going to be an even number.
All right.
And even one.
And even number.
Otherwise.
Otherwise, if the number can not be divided.
If the number can not be divided.
Divided by two without a remainder.
Right.
Without a remainder, then this number is going to be an odd number.
And that's basically the whole difference between these two types of numbers and even number in and
an odd number.
So, for example, if we have for a let's say, for example, example, if we have four, 10, 20,
you know, something like that.
All of these numbers are even because they can be divided by two without having a remainder.
All right.
So all of these numbers are an example, two and even number, even numbers.
And for example, if we have for another example, if we have, let's say, five in 1927, these are
numbers which are odd numbers, because every time, if you will try to divide them by two, then you
will always have a reminder of one, right.
If you divide five by two, then you will get a result of two.
And a reminder of a remainder of just one.
All right.
So these numbers are odd numbers.
So now we know how to classify between odd and even numbers.
And pretty much, I guess you got the idea.
It's not so complicated for those of you who are not so familiar with what are even numbers in odd numbers.
And let's dive to writing or a code in C.
So for that, let's first of all, create.
All right.
Are we I think I will remove these comments that they will not bother you.
I guess you wrote them down also.
So first of all, let's create a variable now.
End now.
All right.
And then we are going to display a nice message.
Print F enter.
Enter a number.
Right.
And then you go scan F percentage D and we are going to read a value to read an integer value and put
it inside in a variable.
And up until this point, everything is similar to the previous sections and exercises that we've seen
so far.
So now we are going to insert our F condition and we are going to use it if.
And here we are going to specify the condition of the checks.
If if the division of NUM over two has a remainder of zero.
And if that's the case, we know that NUM is even.
All right.
So we are going to print a corresponding message.
So print F percentage the is even.
And the backslash.
And here.
And instead of percentage the.
We are going to replace it with the value of nom itself and semicolon in the end.
And the if the conditional result is not true.
All right.
If there is still a remainder.
If we do.
If we divide num by two.
But we got a remainder.
So we use the.
Else section.
And if that's the case we are going to print that phenomena.
Self is odd.
All right.
So percentage the is odd exhibition at the end.
Now pretty much the same line as we of the used right here.
And there you go.
We've written a program that checks.
If a number is even or odd.
And based on the result of the condition, it brings out a corresponding message.
So let's try to run this code.
Let's build and run it.
All right.
There you go.
Enter a number.
Let's see.
We know that, for example, ten should be an even number.
Enter number ten is even rate.
And now let's.
Tried to use something that is odd, for example, five.
There you go.
Five is odd.
All right.
So basically, that's it.
We could just maybe add some message here.
Nahm is an even number to make it more clear.
No.
And also now is an order.
No, just some formality.
All right.
So this is it for these video guys.
And we checked just to summarize everything up.
We checked it.
The remainder is zero.
And based on the result we've printed out.
That's that number is an even number.
Otherwise, it's an odd number.
Another solution.
I will just put it here.
Let's copy and paste that we could have checked if the number has a remainder, which is not zero.
And if that's the case, we are going just to switch places between the print F commands and print that
the number is odd.
Otherwise, it's even even not even.
So that's at least part of code and this part of code.
Basically, they do just the same.
It's just that the condition is formulated a little bit differently.
Here we check for the quality.
And here we check if it if the remainder does is not equal to zero.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.