Advertisement
LukaszPanko

Zad 3

Apr 17th, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main()
  10. {
  11.     int a = 10;
  12.     int b = 20;
  13.     int d=0;
  14.     int s=0;
  15.     cout<<"Wylosowane liczby to: "<<endl;
  16.         srand( time( NULL ) );
  17.     for(int i=0; i!=100; i++)
  18.     {
  19.         cout<<a+rand()%(b-a+1)<<" ";
  20.     d=a+rand()%(b-a+1);
  21.     s=s+d;
  22.     }
  23.     cout<<endl<<"Suma wylosowanych liczb wynosi: ";
  24.     cout<<s;
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement