Advertisement
aiNayan

5(v)

Nov 28th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5. int a[50], n, i, b[50], j;
  6. float avg, sum = 0, nsum = 0, avg_sq_d, result;
  7. printf("Enter the number of elements: ");
  8. scanf("%d", &n);
  9. printf("Enter the elements: ");
  10. for (i = 1; i <= n; i++) {
  11. scanf("%d", &a[i]);
  12. sum += a[i];
  13. }
  14. avg = sum / n;
  15. for (i = 1; i <= n; i++)
  16. nsum += pow((a[i] - avg), 2);
  17. avg_sq_d = nsum / n;
  18. printf("Standard Deviation = %.3lf", sqrt(avg_sq_d));
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement