Exercise 12: Creating Functions
Let's test your ability to create functions.
We'll cover the following
Problem Statement
Implement a function evenOdd
that takes a number as input and prints “even” when the number is even and “odd” when the number is odd.
Use the
cat()
function for printing!
Input
A testVariable
containing the number to be tested.
Output
Print “even” or “odd” depending on the testVariable
.
Sample Input
78
Sample Output
"even"
Test Yourself
Write your code in the given area. If you get stuck, you can look at the solution.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy