Challenge 1: Even or Odd

Let's check whether the number is Even or Odd by solving a challenge in this lesson.

Problem statement

Write a code which will check whether a given integer $number is even or odd. You’re given a variable $temp. Set this to 0 if the $number is even and 1 if the $number is odd.

Hint: Think along the lines of using if-else condition.

Input

An integer.

Output

Boolean 0 if the number is even, and 1 if the number is odd.

Sample input

number = 3

Sample output

1

Coding exercise

Write your code below. It is recommended that you try solving the exercise yourself before looking at the solution.

Good Luck!

#you are given a variable $number which has either an odd or even value
# Write your code here to find out if $number is even or odd
$temp = -1; #set temp to 0 if $number is even
#set temp to 1 if $number is odd