conditionals and character arrays to assign grade based on score
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I W
el 15 de Nov. de 2020
Editada: Walter Roberson
el 17 de Dic. de 2021
function grade = assignGrade(score)
%Enter the commands for your function here.
if (score >= 90) && (score <= 100)
grade = 'A'
end
This is my code to call my function:
score = 75;
grade = assignGrade(score)
assignGrade(91)=grade
none of this works but I have included it to show you what I have tried
0 comentarios
Respuesta aceptada
Walter Roberson
el 15 de Nov. de 2020
score = 75;
grade = assignGrade(score);
fprintf('The grade for score %d was %s\n', score, grade);
function grade = assignGrade(score)
%Enter the commands for your function here.
if (score >= 90) && (score <= 100)
grade = 'A';
else
grade = 'undefined';
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Language Fundamentals en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!