Problem-1 (50pts) Write a MATLAB program to help a student determine his/her let
ID: 2080159 • Letter: P
Question
Problem-1 (50pts) Write a MATLAB program to help a student determine his/her letter grade in a course. The program should prompt the student for his numerical grade and display its corresponding letter grade, assuming A: 90-100, B: 80-89, C: 70-79, D: 60-69, F: 0- 59. If the integer value entered by the user is not in the range of 0-100, display an appropriate e message. The program should run until it is instructed by the user to stop. Problem-2 (50pts) Write a MATLAB program to prompt for and accept from the user ten separate decimal numbers. Among the numbers entered, you are to determine the value of the largest and smallest. After getting the inputs from the user, you are to display on two separate lines two different sentences stating what the values of the largest and smallest numbers are. Your program should also be able to check whether the number of values entered is ten and continue accepting inputs until ten numbers are entered.Explanation / Answer
Question 1. MATLAB Code
clc
clear all
close all
while (1)
A=input('Enter your marks : ');
if ( A>100 || A<0 )
error('Enter your marks between 0 to 1000.')
elseif(A >=90 && A<=100)
fprintf('Your grade in course is: A ');
elseif(A >=80 && A<=89)
fprintf('Your grade in course is: B ');
elseif(A >=70 && A<=79)
fprintf('Your grade in course is: C ');
elseif(A >60 && A<=69)
fprintf('Your grade in course is: D ');
elseif(A >=50 && A<=59)
fprintf('Your grade in course is: F ');
else
fprintf('Your failed in this course: ');
end
str = input('Do you want more? Y/N: ','s');
str1='N';
if strcmp(str,str1)
break
else
end
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.