Hi everyone, glad to be here...

BTW, this is my first post...

please i need help on this
Write a function that is given a list of students' grades (on a scale from 0 to 100), and returns the number of students who have an A in the class (grade >= 90).

here is my code, it is given me the grades but not the number of students

actually it suppose to be in pseudocode but i did the program in PHP

$list = array(0, 10, 20, 20, 40, 30, 80, 90, 90, 80, 98, 94);
	function searchAgrades($list)	{
		
		for ($i = 0; $i <= count($list); $i++)	{
			if ($list[$i] >= 90)	{
				echo  $list[$i] . " ";
			}
		}
	}
searchAgrades($list);

cheers Yirax

int numberWhoHaveA = 0
While elements in ArrayOfGrades
    If currentElement.Score >= 90 
        increment numberWhoHaveA
    end If
end While
Output "Number who received an A is " + numberWhoHaveA
int numberWhoHaveA = 0
While elements in ArrayOfGrades
    If currentElement.Score >= 90 
        increment numberWhoHaveA
    end If
end While
Output "Number who received an A is " + numberWhoHaveA

thnx a bunch

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.