Wiki User
∙ 9y ago1. Calculate the mean average of the N numbers. Suppose it is stored in the variable D.
2. Now calculate the differences between each number with D and square the value. As there are N numbers so store this difference in an array. Example arr[0] = (num0 - D)^2; arr[1] = (num1 - D)^2; arr[N-1] = (numN - D)^2;
3. Now sum array value and divide by N, suppose the value is stored in F. Now square root F. It is the standard deviation of your N number.
I hope you can write the code by yourself or follow the part:
suppose you will store the N numbers in an array num. Now:
int num[N+2], D = 0; //or declare the num array as float or double if there are any precision value
for(int i = 0; i < N; i++)
{
D += num[i];
}
D /= N;
int arr[N+2];
for(int i = 0; i < N; i++)
{
arr[i] = (num[i] - D)^2; //square the difference.
}
int F = 0; //if precision value is accepted then declare F as float or double not int.
for(int i = 0; i < N; i++)
{
F += arr[i];
}
F /= N;
F = sqrt(F); //use #include <cmath> in your header file list so that you can use sqrt() function or simply use #include <bits/stdc++.h>
cout<<F<<endl;
- Thanks
Wiki User
∙ 9y agoWiki User
∙ 12y agoWrite a program to calculate the standard deviation of an array of values.
S.D. = Use nesting function concept
write a lex program to delete space from the program
How to write a program for mouse in microprocessor?
To write a C++ program to display the student details using class and array of object.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
how to write a program that counts automorphic number from 1 to 999
Exactly as in the question: standard deviation!
Exactly as in the question: standard deviation!
The average age is 11 to 12 years of age. Standard deviation is 2 years.
Writing numbers in standard form is writing numbers regular. For example One million in standard form is 1,000,000.
write a lex program to delete space from the program
That really depends on what sort of program you are trying to build, what do you want the program to do?
write an assembly language program to find sum of N numbers
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
fdsgfhgdfhgdf
How to write a program for mouse in microprocessor?
to write it in numbers
program to find maximum of two numbers using pointers