Remove the ] in the top line!
Then
number = randi([0,9])
evens = [2,4,6,8];
odds = [1,3,5,7,9];
if ismember(number,evens)
disp('number is even')
elseif ismember(number,odds)
disp('number is odd')
else
disp('number is zero')
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!