answersLogoWhite

0


Best Answer

1. 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

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Write a program to calculate the standard deviation of an array of values.

S.D. = Use nesting function concept

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a CPP program to find standard deviation of N numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write standard deviation in words?

Exactly as in the question: standard deviation!


How do you write in standard words?

Exactly as in the question: standard deviation!


What is the average age a girl hits puberty also write stander deviation?

The average age is 11 to 12 years of age. Standard deviation is 2 years.


How do write numbers in standard form?

Writing numbers in standard form is writing numbers regular. For example One million in standard form is 1,000,000.


Write a program in Lex to eliminate white space and collect numbers as a token?

write a lex program to delete space from the program


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


How do you write a standard basic program?

That really depends on what sort of program you are trying to build, what do you want the program to do?


Shell program for 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? 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


How do you write a program in objective c numbers 1-100 prime numbers?

fdsgfhgdfhgdf


What does it mean to show a number in standard form?

to write it in numbers


Could you Write a program for 8086 microprocessor that displays on the monitor the average of 2 numbers from an array?

How to write a program for mouse in microprocessor?


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers