mypiecewise(a,b,c) which takes three inputs:
a: A real number. b: A real number. c: A real number.
Note: You may assume that a ≥ 0 and b ≥ 0.
Does: Uses an if statement to do the following:
• If c = 0 return 5(a + b).
• If c > 0 return ab=c.
• If c < 0 return -7.
Returns: As above.

Respuesta :

Answer:

function result = mypiecewise(a, b, c)

   if(c==0)

       result=5(a+b);

   elseif(c>0)

       result=(a*b=c);

   else

       result=-7;

   end

end

Explanation:

It is done in matlab.