Ver código fonte

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

Александр 8 anos atrás
pai
commit
6bdc6a1561
1 arquivos alterados com 28 adições e 0 exclusões
  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;
+    }
+}