Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. #define N 30
  5. void uzupewlnij( int t[]){
  6. int i;
  7. for(i=0; i<N; i++)
  8. t[i]=rand()%200-100;
  9. }
  10.  
  11. void wypisz(int t[]){
  12. int i;
  13. for(i=0; i<N; i++)
  14. printf("%d ", t[i]);
  15. puts("");
  16. }
  17.  
  18. int srednia(int t[]){
  19. int a=0,b;
  20. int i;
  21. for (i=0;i<N;i++)
  22. {
  23. a+=t[i];
  24. }
  25. b=(a/30);
  26. return b;
  27. }
  28.  
  29.  
  30. int main(void)
  31. {
  32. int t[N];
  33. int a,b;
  34. srand(time(0));
  35.  
  36. uzupewlnij(t);
  37. wypisz(t);
  38. printf("Srednia: %d\n", srednia(t));
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement