Question
C++ Exercise 2 [5 points] Write a function that checks whether an integer is even or not. The function should return true if the input
C++ Exercise 2
[5 points] Write a function that checks whether an integer is even or not. The function should return true if the input parameter is even and false otherwise. The function prototype is given below:
// returns true if x is even and false otherwise bool is_even(int x);
[5 points] Write an iterative function that determines the number of even elements in an array a of integers of size n. The function should return the number of elements that are even in array a of size n. Propose an appropriate prototype for your function and then write its code.
[10 points] Write a recursive function to solve the above problem. Propose an appropriate prototype for your function and then write its code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started