Write a function a avmathscorem e This function should take
Solution
function a=av_math_score(m,e)
length1=length(m); %length function returns length of the array
length2=length(e);
avg=0;
y=0;
if length1!=length2 %compare both arrays length and do the below statement if they are not same
fprintf(\'Wrong Input\' );
else %if they have same length do this
for x=0:length2 %loop to iterate through second array to check whether atleast one element is more than 50
if e(x)>50
x=x-1;
break
end
end
if x==length2 //if no element>50 then do the following
fprintf(\'None of the Students qualify\');
else //if there atleast one elemt more than 50
for n=0:length1
if e(n)>50 //for the element in e whose value is greater than 50
y=y+1; //increment count of elements whose value is more than 50
avg=avg+m(n); //add the corresponding element of m to avg
end
end
avg=avg/y //average is determined by dividing avg by total no of elements in e whose value is more than 50
end
end
end
