|
@@ -11,18 +11,13 @@ package javaapp1;
|
|
*/
|
|
*/
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.util.Scanner;
|
|
import java.util.Scanner;
|
|
-
|
|
|
|
|
|
+
|
|
class Average{
|
|
class Average{
|
|
-public static void main(String args[]) throws IOException {
|
|
|
|
- Scanner in = new Scanner(System.in);
|
|
|
|
- int n;
|
|
|
|
- double sum = 0.0;
|
|
|
|
- double avg, t;
|
|
|
|
- n = in.nextInt();
|
|
|
|
- for(int i=0; i < n ; i++) {
|
|
|
|
- t = in.nextDouble();
|
|
|
|
- sum += t;
|
|
|
|
- }
|
|
|
|
- avg = sum / n;
|
|
|
|
- }
|
|
|
|
|
|
+public double averageMark(double[] marks){
|
|
|
|
+double sum=0.0;
|
|
|
|
+for(int i=0;i<marks.length;i++){
|
|
|
|
+ sum+=marks[i];
|
|
|
|
+}
|
|
|
|
+return sum/marks.length;
|
|
|
|
+}
|
|
}
|
|
}
|