Matlab Question
Write a function called DivisibleTest(M) that loops through the values 1 through M and for each number m ({m = 1,2, ...,M}) it should display ‘m is divisible by 2’, ‘m is divisible by 3’, ‘m is divisible by 2 AND 3’ or ‘m is NOT divisible by 2 or 3’. Use a for loop, the function mod or rem to find out whether a number is divisible by 2 or 3, and num2str to convert each number to a string for displaying. You can use any combination of if, else, and elseif.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here