1 view (last 30 days)

Show older comments

My code is:

function i = Three_inputsFunction (x,y,z)

if x>y>z || y>x>z

x+y

elseif x<y<z || x<z<y

y+z

else

x+z

end

end

>> Three_inputsFunction (-18,-3,-6)

ans =

-21

Query : Why is the answer '-21' and not '-9'?

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!