clear number = input('Give an integer: '); remainder2 = rem(number,2); remainder3 = rem(number,3); if remainder2==0 & remainder3==0 'Your number is divisible by both 2 and 3' else if remainder2==0 'Your number is divisble by 2 but not by 3' else if remainder3==0 'Your number is divisible by 3 but not by 2' else 'Your number is not divisible by either 2 or 3' end end end % From https://www.math.colostate.edu/~yzhou/course/matlab_doc/matlab_programming_intro.html