Question: Write and test the function even_odd() that accepts a vector of integers as input and returns a two-element vector containing the number of evens and

Write and test the function even_odd() that accepts a vector of integers as input and returns a two-element vector containing the number of evens and the number of odds. The function would be used as follows: \( \begin{array}{ll}\text { even_odd }(9: 1) & \text { \#returns } 45 \text { (4 evens, } 5 \text { odds) } \\ \text { even_odd }(c(0,1,2,3,4,5,6,7,8,9) \text { ( } 0,5 \text { returns } 45 \text { (4 evens, } 5 \text { odds) }\end{array} \) Zero is not considered an even number. Use the ifelse() and sum() functions inside the body of the even_odd function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
