00:01
Okay, so in this question, we're going to write a function is even that will be able to tell us if a number is even.
00:10
So in order to do that, i'm going to write it in python since no language is specified in the question, but the logic will be the same in every question in every programming language.
00:22
So basically what we're going to use is the whole number division.
00:28
So for example, if we have a number, let's say seven.
00:33
Seven and divided by two would be two times three plus one.
00:40
Seven is not an even number because the remainder of the division, the whole number division is one.
00:50
Same thing for, i don't know, 13.
00:56
So 13 would be equal to two times six.
01:02
Plus one.
01:05
So again, not an even number because the remainder of the division is zero.
01:12
But if we look, for example, at 24, then 24 is 2 times 12 plus zero.
01:22
So the remainder is zero.
01:25
24 is an even number.
01:28
Same thing with 8.
01:31
8 is 2 times 2 times.
01:34
2 times.
01:35
4 plus 0.
01:37
So the remainder is 0.
01:40
Therefore, we know it's an even number.
01:42
So that's the logic we're going to use to implement our function.
01:46
So then the define our function is even and this function is going to take as an input a number.
01:55
Now if the number, it's remainder, so how do you compute the remainder using python? it's the percent sign operator...