Hello again, welcome to this new video where we will see how to determine if a number is even or odd . we are going to do exercise
number fourteen. in this exercise we observed a user request one number to identify odd or even numbers and print the result to do this we write our input processing
output my input is type one number. the process is determinate if it's an
even or odd number . And the output: a message it was odd or even numbers to determine if one number is even or odd. we observed that in PSEint program there are function
call it mod. Mod is a Module.
What is module? is an operator that remainder of entire division. For example 10 divided by 2 the result is 5 and the remainder
is 0. if I divide 11 by 2 the result is 5 and the remainder is 1. so, that any
number divided by 2 could result 0 or 1 The reminder is 0 or 1. not other.
if I receive 0 the number is even if the remainder is 1 the number is odd. for example 2 / 2 the remainder is 0.
3 / 2 the remainder is 1 4 / 2 the reminder is 0. 5 by 2 the
remainder is 1. no other numbers we design this algorithm is called
oddEvenNumbers and from input num1 return number one.
The process is
remainder equal num1 mod 2. The result of remainder variable is 0 or 1 and condition would be reminder is equal to 0 it's equal to 0? yes and take the True way and print the number is even. But the reminder is equal to 1. take the false way and print the numerous odd. We testing. the operation type numeral 20 and it print, yes the number is even testing with other number 4 3 2 1
and print the number is odd. correctly We testing our program its works.
correctly. which you find too useful.
see you next time. Good bye.