Przeglądaj źródła

Создана ветвь

Александр 8 lat temu
rodzic
commit
6bdc6a1561
1 zmienionych plików z 28 dodań i 0 usunięć
  1. 28 0
      src/javaapp1/Average.java

+ 28 - 0
src/javaapp1/Average.java

@@ -0,0 +1,28 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package javaapp1;
+
+/**
+ *
+ * @author Александр
+ */
+import java.io.*;
+import java.util.Scanner;
+ 
+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;
+    }
+}