Advertisement
aiNayan

5(i)

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