- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStandardDeviation.java
More file actions
Latest commit
26 lines (22 loc) · 566 Bytes
/
Copy pathStandardDeviation.java
File metadata and controls
26 lines (22 loc) · 566 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
importjava.util.Scanner;
publicclassMeanAndStrdDev
{
publicstaticvoidmain(String[] args)
{
Scannerinput = newScanner(System.in);
System.out.println("Enter 10 numbers: ");
doublenumber = 0;
doubletotal = 0;
doubledev = 0;
for (inti=0; i<10; i++)
{
number = input.nextDouble();
total += number;
dev += number * number;
}
System.out.printf("The mean is %.2f\n", (total / 10));
dev = Math.sqrt(((dev -((total * total) / 10)) / 9));
System.out.printf("The standard deviation id %f", dev);
input.close();
}
}