forked from IF-LK-2020/array
average
This commit is contained in:
@@ -159,7 +159,10 @@ public class Arrays {
|
||||
* Für ein leeres Array wird 0 zurück gegeben.
|
||||
*/
|
||||
public double avg( int[] pArray ) {
|
||||
return 0;
|
||||
if (pArray == null || pArray.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
return sum(pArray) / pArray.length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user