Advertisement
Guest User

Piwońska

a guest
May 27th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define N 10
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9. int i;
  10. float sum = 0;
  11. float sr;
  12. float tab[N];
  13.  
  14. printf("Podaj %d elementów tablicy:\n",N);
  15.  
  16. for (i=0; i<N; i++)
  17. {
  18. scanf("%f", &tab[i]);
  19. sum+=tab[i];
  20. }
  21.  
  22. sr=sum/N;
  23.  
  24. printf("Srednia arytmetyczna to: %.2f\n", sr);
  25.  
  26. for (i = 0; i < N; i++)
  27. {
  28. if (tab[i]>0 && tab[i]>sr)
  29. {
  30. printf("Liczby dodatnie, większe od œredniej arytmetycznej= %.2f\n ", tab[i]);
  31. }
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement