MichalWalczak

Zad 3 PSEUDORANDOM

Apr 18th, 2020
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. using namespace std;
  5.  
  6. void losowanie3(){
  7. int x, suma=0;
  8. srand(time(NULL));
  9. for(int i=1; i<=100; i++){
  10.     x=rand()%11+10;
  11.     cout<<x<<endl;
  12.     suma += x;
  13. }
  14. cout<<"Suma="<<suma;
  15. }
  16.  
  17. int main()
  18. {
  19.     losowanie3();
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment