Search for question
Question

3. Use a while loop to traverse the vector below to find all even values. For each even value found, your code should store these values in a new array, then display this array. Even though you are specifically traversing the vector below, your code should be general enough to work on an array of any length, including length one. You must use a while loop to get full points. Do not use functions like find()). Hint: Use the function mod() (for modulus). If mod(x,2) returns 0, then x is even. If mod(x,2) returns 1, then x is odd. x= [7 1 2 4 -2 896]

Fig: 1