PLEASE ONLY ATTEMPT IF YOU ARE SURE! I need the answer to number 8, but you can\
ID: 3755334 • Letter: P
Question
PLEASE ONLY ATTEMPT IF YOU ARE SURE!
I need the answer to number 8, but you can't do number 8 without number 7. so if you could do that as well, that would be great!
Explanation / Answer
Answer 7
=========
Save the function in a file named numcomp1.m
function v = numcomp1()
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
if num1 == num2
v = 0;
elseif num1 > num2
v = 1;
else
v = -1;
end
Now in command window you can call numcomp1() as
> numcomp1()
========================================================
Answer 8
========
Save the following code in numcomp2.m file
function v = numcomp2(num1, num2)
if num1 == num2
v = 0;
elseif num1 > num2
v = 1;
else
v = -1;
end
------
Now in command window, you can call the function numcomp2() as
> numcomp2(10, 5)
> numcomp2(-3, -3)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.