I want the user to input a non zero even interger. However with my current code, even non zero intergers like '2' aren't recognised as so. I could remove the ~(isinteger(a) but then the code fails when user inputs a decimal. How can i incoporate it to say that the number inputted must be an integer.
prompt= 'enter non zero even integer'z= input(prompt)n= rem(z,2);while (n==1)|| (a==0)||~(isinteger(z)) z= input ('try again'); n= rem(z,2); enddisp('This number is a non zero even integer');
Best Answer