Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using above concept, Write a MATLAB program to enter marks of three subjects nam

ID: 1994442 • Letter: U

Question

Using above concept, Write a MATLAB program to enter marks of three subjects namely, Physics, History, and Psychology on a scale of 100. Calculate AVERAGE. If AVG is greater than or equal to 75, Display Grade as A. If AVG is greater than 50 and less than 75, Display Grade as B. If AVG is greater than 25 and less than 50, Display Grade as Otherwise, Grade is F. Write a MATLAB program using for loop to compute the sum of the squares of all integers from 2 to 20. 2^2 + 3^2 + 4^2 + ... + 20^2. Write a for loop to compute the sum of all of the odd integers from 1 to 501 (inclusive) 1^2 + 3^2 + 5^2 + ... + 501^2. Using while loop, write a MATLAB program to display all the even numbers and odd numbers between 10 to 50.

Explanation / Answer

1   Phy = 56 ; His = 47 ; Psy = 68 ;
Avg = (Phy + His + Psy)/3 ;
if (Avg < 100 & Avg > 75)
disp('student got an A')
elseif (Avg < 75 & Avg > 50)
disp('student got a B')

elseif (Avg < 50 & Avg > 25)

disp('student got a C')
else
disp('student got an F')
end

2.   sum = 0;
for k = 2:20
sum = sum + k^2 ;
end
sum

3. sum = 0;
for k = 1:2:501
sum = sum + k^2 ;
end
sum


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote