# Write a function called eligible that helps the admission officer of the Graduate School decide whether the applicant is eligible for admission based on GRE scores. The function takes two positive scalars called v and q as in

887 views (last 30 days)
Moeez ur Rehman Qureshi on 11 Jul 2019
Commented: Image Analyst on 6 Sep 2020 at 15:32
if v>=92 && q>=88;
fprintf('true')
else
fprintf('false')
end

Show 3 older comments
Saisunder Chaganty on 12 Apr 2020
function admit= eligible(v, q)
if ((v+q)/2)>=92 && v>88 && q>88
else
end
Kilaru Venkata Krishna on 2 May 2020
m=(v+q)/2;
if (m>=92&(v>88 & q>88))
else
end
Pritam Ghosh on 14 Jun 2020
function admit = eligible(v, q)
if (((v+q)/2)>= 92) && (v>88 & q>88)
else
end

Yamen Al-Jajan on 24 Nov 2019
if v>88 & q>88
ave=(v+q)/2;
if ave>=92
else
end
else
end

#### 1 Comment

Rik on 24 Nov 2019
Why are you providing a complete working solution to a homework question? Given that this is 2 months old, cheating is probably not really an issue, but future students with the same assignment can just copy your code without learning anything, which means they will need your help for every future project as well.

Steven Lord on 11 Jul 2019
Nowhere in your function do you define the variable admit the function returns as its output. You haven't shown the full text of the homework question but I suspect it tells you to have your function return true or false instead of printing the text "true" or "false". To do that assign a value to the variable.

Show 5 older comments
nitish Yadav on 23 Sep 2019
if (q+v)/2 >= 92 && (q>88 && v>88)
else
end
Walter Roberson on 23 Sep 2019
q and v are numeric values. When you use the && operator between them, admit=q&&v is defined as
if q ~= 0
if v ~= 0
else
end
else
end
However, the assignment makes no mention of testing for zero or not.
In particular when you get to your else branch, admit=~q&&v then that would be true if q was 0 and v was non-zero, leading you to admit someone with a score of 0 for q when the assignment would require that they be rejected because 0>88 is false.
vignesh suresh on 4 Mar 2020
if ((v+q)/2)>=92 && ((v>88)&(q>88))
else
end

evan muas on 9 Dec 2019
if (v+q)/2>=92
if v>88 && q>88
else
end
else
end

Akash Devalekar on 19 Dec 2019
if 92<=((v+q)/2) && 88<v && 88<q;
else
end

mohammad elyoussef on 4 Apr 2020
function f = eligible(a,b)
c = median(a+b);
if c >= 92 && a > 88 && b> 88
f = true;
else
f = false;
end

#### 1 Comment

Walter Roberson on 22 May 2020
The question requires that the average of the two grades is used, but you are taking the sum of the two grades. The sum of the two is a scalar, and the median() of a scalar is the same scalar.

muyiwabowen on 22 May 2020
function admit= eligible(v, q)
a = mean([v q])
if a>=92 && v>88 && q>88
else
end

Aasma Shaikh on 26 May 2020
Edited: Aasma Shaikh on 26 May 2020
function admit = eligible (v, q)
avg= (v+q)/2;
if ((avg>=92) && ((v >88) && (q>88)))
else
end %----- COPY, PASTE AND RUN THIS DIRECTLY

AYUSH MISHRA on 4 Jun 2020
function admit = eligible (v, q)
avg= (v+q)*0.5;
if (avg>=92 && v >88 && q>88 )==1
else
end
SOLUTION;
eligible(99,88)
ans =
logical
0

#### 1 Comment

Walter Roberson on 7 Jun 2020
Right, because 88 exactly is not over 88.

ROHAN SUTRADHAR on 7 Jun 2020
function admit = eligible(v,q)
x = ((v+q)/2);
if (x>=92)&&((v>88)&&(q>88));
else
end

Bhavesh Gole on 3 Aug 2020
function admit = eligible(v,q)
k =(v+q)/2;
if (k>=92 && v>88 && q>88)
else
end
end

Dinesh Nali on 28 Aug 2020 at 17:35
% average of verbal and quantitative
average_score = (v+q)/2;
% logical and condition for admission
if average_score>=92 && v>88 && q>88
else
end

Rik on 28 Aug 2020 at 19:59
Can you explain why I shouldn't delete this answer?
Dinesh Nali on 29 Aug 2020 at 4:25
Hi Sir, I have given the solution to the question asked. I have tried the soluition in the Matlab and then given the solution. If you think it is either wrong or the solution is not upto mark, please the choice is your's , you can delete this answer.
I thought to help others, what ever i know in the fundamentals.
Thanks and regards

Khom Raj Thapa Magar on 6 Sep 2020 at 9:36
function admit = eligible(v,q)
avg = (v+q)/2;
if (avg >= 92) && (v>88 & q>88)
else
end
Easiest way to tackle with the problem

#### 1 Comment

Image Analyst on 6 Sep 2020 at 15:32
Not the simplest. And your answer, but with the correct number of &, has already been posted. I think the simplest is
function admit = eligible(v, q)
admit = (v+q)/2 >= 92 && v > 88 && q > 88;

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by