Write a MATLAB program that will a Request the user for an a

Write a MATLAB program that will a) Request the user for an array. b) Return another array reporting whether the each of the entries is even or odd. An example of how the input and output should look like:

Solution

vec=input(\'enter array of integers :\');

even=[]

for i=0:size(vec)

if(vec[i]%2==0)

even[i]=\'even\'

else

even[i]=\'odd\'

end

end

Write a MATLAB program that will a) Request the user for an array. b) Return another array reporting whether the each of the entries is even or odd. An example

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site