How can i solve this exam practise question
Show older comments
5 Comments
madhan ravi
on 11 Jun 2020
Show effort to get help.
madhan ravi
on 11 Jun 2020
Upload code as text.
Rik
on 11 Jun 2020
This time I edited your post for you. Next time, please use the tools explained on this page to make your question more readable.
Where did the second input to your function go? And why is your end statement missing?
As a side-note: it may be very difficult to complete assignments like this on a mobile device.
Rik
on 14 Jun 2020
(original question and comments by Comfort Chauke (the name of OP before it was changed to Wilson) recovered from Google cache)
Comfort Chauke on 11 Jun 2020 at 9:39:
How can i solve this exam practise question

Comfort Chauke on 11 Jun 2020 at 10:33:
function [minsum, maxsum]=MyFunction(L)
sum=0;
for i=1:length (L)
sum=sum+L(i);
end
min=L(1);
max=L(1);
for i=1:length (L)
if L(i)<min
min=L(i);
end
if L(i)>max
max=L(i);
end
end
minsum=sum-max
maxsum=sum-min
Comfort Chauke on 11 Jun 2020 at 12:03:
That's my problem i don't know how make calculate the minimum and maximum values that can be obtained from adding K elements
Rena Berman
on 12 Oct 2020
(Answers Dev) Restored edit
Accepted Answer
More Answers (1)
madhan ravi
on 11 Jun 2020
Edited: madhan ravi
on 11 Jun 2020
doc mink
doc maxk
doc sum
2 Comments
Rik
on 11 Jun 2020
Since this question is supposed to be run in Octave, the students are forced to use other functions, since mink and maxk were introduced in R2017b, but aren't implemented in Octave.
madhan ravi
on 11 Jun 2020
Aha thanks Rik , didn't know that.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!