Question

Using MATLAB, prompt the user to enter a vector containing 3 elements that correspond to the...

Using MATLAB, prompt the user to enter a vector containing 3 elements that correspond to the scores a student received in three exams. Compute the average of the scores. If the average is less than 60, send a message to the command window telling the user that the student did not pass the course. Otherwise, send a message to the command window telling the user that the student has passed the course.

Homework Answers

Answer #1
v = input("Enter vector of 3 values: ");
if mean(v) < 60
    disp("You did not pass the course.");
else
    disp("You passed the course.");
end

The above code in matlab takes the input from user in form of vector and calculates the mean of the vector. If the mean is less than 60, then it displays You did not pass the course else it displays You passed the course

OUTPUT 1:

Enter vector of 3 values: [60 80 61]
You passed the course.

OUTPUT 2:

Enter vector of 3 values: [40 60 50]
You did not pass the course.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT