Write a MATLAB function that accepts two integer (i.e., whole) numbers as input, and returns
the sum of all the integers in between, including the two input variables.
I just don't get the concept of the question. Help is appreciated! :)
the sum of all the integers in between, including the two input variables.
I just don't get the concept of the question. Help is appreciated! :)
-
If your first integer is 3 and your second one is 6, your script has to return the result of 3 + 4 + 5 + 6
Not very hard, is it?
a = input('Give me an integer: ');
b = input('Give me another integer: ');
sum(a : b)
I suggest you see
http://matrixlab-examples.com/matlab-com…
http://matrixlab-examples.com/vectors.ht…
.
Not very hard, is it?
a = input('Give me an integer: ');
b = input('Give me another integer: ');
sum(a : b)
I suggest you see
http://matrixlab-examples.com/matlab-com…
http://matrixlab-examples.com/vectors.ht…
.
-
x equals 0
for (x up to integer)
x
for (x up to integer)
x