write a c++ programme that calculate the standard deviations of number inputs

0 votes
asked Jun 19, 2019 by anonymous

1 Answer

0 votes
answered Jun 24, 2019 by SalmanSubetha (140 points)

// Standard Deviations of n number

#include <stdio.h>
#include <math.h>
int main()
{
    float arr[100],sum=0,mean,sd=0,result;
    int i,len;
    printf("Enter the length of array");
    scanf("%d",&len);
    for(i =0; i < len ;i++)
    {
        scanf("%f",&arr[i]);
        sum = sum + arr[i];
    }
      mean = sum / len;
    
    printf("%f",sum);
    printf("%f",mean);
    
    for(i=0;i <len;i++){
        
        sd += pow(arr[i] - mean,2);
        result =sqrt(sd/10);
    }
    printf("The Standard devision value is %.6f",result);

    
    return 0;
}

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...