Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Homework help
Replies: 1   Last Post: May 9, 2013 10:31 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
simon hsiao

Posts: 1
Registered: 5/8/13
Homework help
Posted: May 7, 2013 11:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 1-30

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


Date Subject Author
5/7/13
Read Homework help
simon hsiao
5/9/13
Read Re: Homework help
Steven Lord

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.