Explanation:
We have created a function named "Value" which takes one argument "userValue" as input from the user.
Then we used if else statement to check if the user has entered a value greater than 100 then add 5 to the userValue and assign it to finalValue.
Otherwise add 3 to the userValue and assign it to finalValue and display the result of finalValue.
Then we tested the function with Value(200) and Value(85) and it returned the correct output.
Matlab Code:
function finalValue=Value(userValue)
userValue=input("Please Enter a value: ");
if(userValue>100)
finalValue=userValue+5;
else
finalValue=userValue+3;
disp(finalValue)
end
Output:
Test 1:
Value()
Please Enter a value: 200
ans = 205
Test 2:
Value()
Please Enter a value: 85
ans = 88