do anyone have example how this is done

Define the array that is the result of the exam seven students who took the subject of Web services and have won 77, 98, 56, 87, 64, 55, 82 points. Print all of the results, the minimum and maximum number of points, compute the average winning score per student.

I am confused at min and max number of points, that is 100 right? so I need to count avarage number for example of 77 in percents or what, from 0 to 100, what avarage number, 77 is only number that student won

or I might need to set min and max from those numbers, but what next, its not avarage of all students together, but for every single student, student that won 77 points what is avarage for that, its 77

I think you have to use Arrays

I think that too, but what is goal, am confused about avarage stuff, it says avarage number per student, not avarage number of all students together

Member Avatar for diafol

The min and max I assume would be from your sample. The average is just the sum of all values divided by the number of values - whether it is for all students or in the case of a single student, you would need all his/her values - which you do not specify. If you don't know which you need, I hardly think that we're in a position to tell you.

$points = array(7, 98, 56, 87, 64, 55, 82);
$min = min($points);
$max = max($points);
$ave = array_sum($points)/count($points); // you can format this with number_format()

Is that it?

all I know is in that text, I guess I need to print array from min to max like

55
56
64
...

but idk what next, avarage number can be choosed from all numbers together, but not for single one

Member Avatar for diafol

ordering values in an array can be done with sort()

but idk what next, avarage number can be choosed from all numbers together, but not for single one

This has got the smell of an assignment to it. If it is, perhaps you should ask? Second guessing is pointless.

What diafol suggested looks like the best possible solution.

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.