Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Homework help
Posted:
May 7, 2013 11:42 PM


Hello guys so I need some help on my homework ; The problem is to make an loop function from n 1:30 And see if it is even or odd. Once I find that out I also have to label each value if it is divisible by 2 or 3 or by both .
The problem I am having is I don't know how to make the loop function or the if and end function to make it compute the value is even and label the function is divisible by 2 n not 3 . I have to do this for all the function from 130
So far I got this : n = 1:30; a = n / 2; b = n / 3; a1 = rem(n,2); b1 = rem(n,3);
if a1 == 0 && b1 == 0 disp ('x is divisble by both 2 and 3'); else a1 == 0 disp ('y is divisible by 2, but not by 3'); else b1 == 0 disp ('z is divisible by 3, but not by 2'); end



