Java
xxxxxxxxxx
public class StandardDeviation {
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
}
Standard Deviation = 2.872281
Linux - How to Install anc-api-tools
Linux - How to Install curvedns
Python - Check if a Number is Positive, Negative or 0
Linux - How to Install zenmap
C - Count Number of Digits in an Integer
C++ - Check Whether a Number is Prime or Not
JavaScript - Check Whether a String Starts and Ends With Certain Characters
C++ - Check Leap Year
C - Find Largest Number Using Dynamic Memory Allocation
Kotlin - Reverse a Number
Linux - How to Install zfs-test
C++ - Find Quotient and Remainder
Kotlin - Round a Number to n Decimal Places
Linux - How to Install xbitmaps
Kotlin - Find Factorial of a Number
Java - Reverse a Number
Python - Writing Excel (XLSX) Files
GoLang - Range
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month