Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main() {
  7. srand(time(0));
  8. int liczba[21], wyst[6];
  9. for (int i=0; i<6;i++) wyst[i]=0;
  10. for (int i=0; i<21;i++){
  11. liczba[i] = rand()%(7-2+1)+2;
  12. cout<<liczba[i]<<endl;
  13. wyst[liczba[i]-2]++;
  14.  
  15. }
  16. for(int i=0;i<=7-2;i++){
  17. cout<<"liczba "<<2+i<<" wystapila "<<wyst[i]<<" razy\n";
  18. }
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement