Please help me to check what did I do wrong here, thank you! it\'s a matlab ques
ID: 3845110 • Letter: P
Question
Please help me to check what did I do wrong here, thank you! it's a matlab question
Question 2: consider the following scheme which maps an integer quiz grade to a corresponding letter grade: 9 or 10 is an A 8 is a 'B' 7 is a 'C' 6 is a 'D' Anything below 6 is an 'F' Write a function called letgrade which receives an integer quiz grade and returns a corresponding letter as per the scheme above. Also the function returns the letter X if the quiz grade is not valid. This can be implemented with if else statements.Explanation / Answer
You have missed the brackets in the conditional statements which may cause an error in the code. Another mistake is that you have missed the semicolon in this statement=> b=('B');
Here is the corrected code,
function b=letgrade(x)
if (x>=9)&&(x<=10)
b=('A');
elseif (x==8)
b=('B');
elseif (x==7)
b=('C');
elseif (x==6)
b=('D');
elseif (x<6)
b=('F');
else
b=('X');
end
end