Eastonc2
- 19
- 0
so for a practice exam we have the following problem:
1.
Write a commented and well-structured Matlab function that takes two positive integers, a and b, as the input, and then displays the sum of all numbers that are odd or can be divided by 3 without a remainder between a and b (including a and b). For example, if the user inputs 6 and 12, the program should display 45 as the output (sum of 6,7,9,11,12: 6+7+9+11+12=45). If a number is both odd and can be divided by 3 without a remainder, your program should include it only once in the summation (as in the case of 9 in the example above).
2. I am very new to MATLAB, as in, I just started two weeks ago, and have never done any programming of any kind prior to this course, so i have no intuition when it comes to this. After attending every class period, I know that we have not covered how we're supposed to approach this problem. The lab portion is handled by a Chinese study abroad student, and I cannot get past the language barrier with her. I have a tenuous grasp of the subject at hand without trying to interpret what she is trying to say.
3. My request: Please explain how to go about this in a form that I, an idiot, can understand. I honestly don't even know where to begin with this.
We have covered basic structuring of if-elseif, for-loops, and while-loops.
1.
Write a commented and well-structured Matlab function that takes two positive integers, a and b, as the input, and then displays the sum of all numbers that are odd or can be divided by 3 without a remainder between a and b (including a and b). For example, if the user inputs 6 and 12, the program should display 45 as the output (sum of 6,7,9,11,12: 6+7+9+11+12=45). If a number is both odd and can be divided by 3 without a remainder, your program should include it only once in the summation (as in the case of 9 in the example above).
2. I am very new to MATLAB, as in, I just started two weeks ago, and have never done any programming of any kind prior to this course, so i have no intuition when it comes to this. After attending every class period, I know that we have not covered how we're supposed to approach this problem. The lab portion is handled by a Chinese study abroad student, and I cannot get past the language barrier with her. I have a tenuous grasp of the subject at hand without trying to interpret what she is trying to say.
3. My request: Please explain how to go about this in a form that I, an idiot, can understand. I honestly don't even know where to begin with this.
We have covered basic structuring of if-elseif, for-loops, and while-loops.