Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <unistd.h>
  5.  
  6. int kotaz(){
  7. return (int)(rand() / (RAND_MAX + 1.0) * 4.0 + 1.0);
  8.  
  9. }
  10.  
  11. int main() {
  12. int zarodek;
  13. time_t tt;
  14. zarodek = time(&tt);
  15. srand(zarodek); // za zarodek wstawiamy pobrany czas w sekundach
  16.  
  17. int tab[10];
  18. int i,c=0,m;
  19. for(i=0;i<10;i+=1)
  20. {
  21. tab[i]=kotaz();
  22. printf("%d ",tab[i]);
  23. }
  24. for(i=0;i<10;i+=1)
  25. {
  26. if(tab[i]%4==0)
  27. if(tab[i]>c)
  28. c=tab[i];
  29. }
  30. printf("Najwieksza liczba to %d",c);
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement