Spaces:
Running on Zero

Codefixer / examples /Broken.java
Angshul's picture
Upload 12 files
3838e30 verified
Raw History Blame Contribute Delete
528 Bytes
import java.util.Scanner;
public class Stats {
static double mean(int[] xs) {
int total = 0;
for (int x : xs) total += x
return (double) total / xs.length;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] xs = new int[n];
for (int i = 0; i < n; i++) xs[i] = in.nextInt();
System.out.printf("mean = %.2f%n", mena(xs));
Strin label = "done";
System.out.println(label);
}
}