Determine the average score in a scores array. Then, traverse scores again and d
ID: 3827406 • Letter: D
Question
Determine the average score in a scores array. Then, traverse scores again and determine how many scores are above the average and how many below - output both these number. avg = 0; scores - [99.2, 555, 83.3, 77.7, 88.9, _ 93.4); Consider an array, letters, that contains elements made up of only single letters (either uppercase or lowercase). Determine the total number of vowels and the total number of consonants (assume y is a consonant). Output the number of vowels and the number of consonants. You may assume that the array only contains letters, though the letters may be uppercase and lowercase. An array grades contains percentages of test grades. Populate a corresponding letter Grades array with the letter grade:Explanation / Answer
2)
clc
clear all
score=[99.2 55.5 83.3 77.7 88.7 93.4];
i=length(score)
sum=0;
for j=1:1:i
sum=sum+score(j);
end
avg=sum/i
below=0;
above=0;
for j=1:1:i
if(score(j)<avg)
below=below+1;
elseif (score(j)>avg)
above=above+1;
end
end
above
below
3)
clc
clear all
Letter=['t','o','d','a','y','I','s','t','e','s','t','t','h','s']
v=0;
c=0;
l=length(Letter)
for i=1:1:l
if (Letter(i)=='a'|| Letter(i)=='A' || Letter(i)=='e'|| Letter(i)=='E' || Letter(i)=='i' || Letter(i)=='I' || Letter(i)=='o' || Letter(i)=='O'|| Letter(i)=='u'|| Letter(i)=='U')
v=v+1;
else
c=c+1;
end
end
v
c
4)
clc
clear all
Marks =[ 90 89 80 69 99 55 75 42 42 77 99]
l=length(Marks);
for i=1:1:l
if(Marks(i)<=100 && Marks(i)>=90)
letterGrades(i)='A';
elseif(Marks(i)<=89 && Marks(i)>=80)
letterGrades(i)='B';
elseif(Marks(i)<=79 && Marks(i)>=70)
letterGrades(i)='C';
elseif(Marks(i)<=69 && Marks(i)>=60)
letterGrades(i)='D';
elseif(Marks(i)<59)
letterGrades(i)='F';
end
end
letterGrades
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.