- #1
roam
- 1,271
- 12
http://img16.imageshack.us/img16/3078/15688239.gif
So here's my script:
So for example I tried x = [70, 50, 30, 45]:
I got the following answer:
Well, it calculated the mark correctly, but I don't understand why it says "student fails" when it should be displaying "student passes".
It also doesn't display the grade. What's the problem? Can anyone help? ![Roll Eyes :rolleyes: :rolleyes:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
So here's my script:
Code:
x=[a, b, c, d];
w=[0.65 0.2 0.05 0.1]';
final=x*w;
disp(final);
if 65>final>=50
disp('Grade is: C')
elseif 80>final>=65
disp('Grade is: B')
elseif final>=80
disp('Grade is: A')
If final>=50
disp('Student Passes')
else
disp('Student Fails')
end
So for example I tried x = [70, 50, 30, 45]:
Code:
x=[70, 50, 30, 45];
w=[0.65 0.2 0.05 0.1]';
final=x*w;
disp(final);
if 65>final>=50
disp('Grade is: C')
elseif 80>final>=65
disp('Grade is: B')
elseif final>=80
disp('Grade is: A')
If final>=50
disp('Student Passes')
else
disp('Student Fails')
end
I got the following answer:
Code:
61.5000
Student Fails
Well, it calculated the mark correctly, but I don't understand why it says "student fails" when it should be displaying "student passes".
Last edited by a moderator: