boolean even or odd?
Hey, I'm just wondering but how would you write a small piece of code using a boolean that adds up two numbers and tells you if it is true or false on if the sum of the two numbers is even.
I know you guys like to see the people asking these kinds of things put up piece of broken code etc but i really have no clue.
thanks to any future replies :D
Use the modulus operator(%) it returns the remainder after division
Calculate the sum of the numbers and then use this operator to decide if it's even. Hint: what number evenly divides into all even numbers?
5 % 2 == 1
50 % 10 == 0
thanks Sunde :D what a great idea!
You are welcome. Glad to have helped you out.