0

```
package deviation;
import java.util.Scanner;
public class Deviation {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter n: ");
int n = input.nextInt();
System.out.println("Enter " + n + " numbers: ");
double[] x = new double[n];
int i;
for (i = 0; i<n; i++) {
x[i] = input.nextDouble();
}
double mean = mean(x, i);
double deviation = deviation(x, i);
System.out.println("The mean is " + mean);
System.out.println("The standard deviation is " + deviation);
}
public static double deviation(double[] x, double i) {
double mean = mean(x, i);
double num = 0;
num += Math.pow(x[i] - mean, 2);
double n;
double den = n - 1;
double deviation = Math.sqrt((num/den));
return deviation;
}
public static double mean(double[] x, double i) {
double sum = 0;
for(int j=0;j<i;j++) {
sum += x[j];
}
return sum / i;
}
}
```