diff --git a/Lab11.iml b/Lab11.iml new file mode 100644 index 0000000..4de040d --- /dev/null +++ b/Lab11.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestArray.scala b/src/TestArray.scala new file mode 100644 index 0000000..64acc84 --- /dev/null +++ b/src/TestArray.scala @@ -0,0 +1,9 @@ +object TestArray extends App { + def arrayAvg(arr: Array[Double]): Double = { + if (arr.isEmpty) return 0 + return arr.sum / arr.length + } + + val arr: Array[Double] = Array.range(1, 1001).map(i => i.toDouble) + println(arrayAvg(arr)) +}