Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n,sum = 0;
- cout<<"How many students? ";
- cin>>n;
- float score[n];
- for( int i = 0 ; i < n ; i++ )
- {
- cin>>score[i];
- sum += score[i];
- }
- float avg,sigma;
- avg = sum/n;
- for( int j = 0 ; j < n ; j++ )
- {
- sigma += pow(score[j] - avg , 2);
- }
- cout<<"SD = "<<sqrt(sigma/n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement