Advertisement
Guest User

yayeet

a guest
Jan 21st, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <random>
  3. #include <time.h>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7. int main()
  8. {
  9. int tablica[100];
  10. int sumap=0;
  11. int wsrednia=0;
  12. srand(time(NULL));
  13. for (int i=0;i<100;i++)
  14. {
  15. tablica[i] = rand()%100+1;
  16. cout<<tablica[i]<<endl;
  17. }
  18.  
  19. for (int i=0;i<100;i++)
  20. {
  21. if (tablica[i]%)
  22. {
  23. sumap++;
  24. }
  25. if (tablica[i])
  26. {
  27. wsrednia++;
  28. }
  29.  
  30. }
  31. cout<<"suma parzystych: "<<sumap<<endl;
  32. cout<<"wiekszych od sredniej: "<<wsrednia<<endl;
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement