How can I do this, not to show only min and max number, but all numbers like 23,45,65,78,34,21,56
I need command to sort this out from min to max and display it, then get avarage number and display it too
Thanks in advance
How can I do this, not to show only min and max number, but all numbers like 23,45,65,78,34,21,56
I need command to sort this out from min to max and display it, then get avarage number and display it too
Thanks in advance
Jump to PostUse the sort method. Refer: this.
Jump to Postecho array_sum($points)/count($points);
ok I did one part, now I need to get avarage number from those 7 numbers
<?php
$points = array(77, 98, 56, 87, 64, 55, 82);
sort($points);
foreach ($points as $key => $val) {
echo "Student[" . $key . "] = " . $val . "\n";
}
?>
There is no real function for this that I know of. Just find average when you traverse through the array. Simple Programming. If you don't know how to make a program to calculate average, I'm afraid you need to get much better at prgoramming then.
echo array_sum($points)/count($points);
i just did that and this
echo "Totalni broj poena = " . array_sum($points) . "\n";
echo $avg = array_sum($points)/count($points);
thanks for help
solved
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.