Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int a = 10;
- int b = 20;
- int d=0;
- int s=0;
- cout<<"Wylosowane liczby to: "<<endl;
- srand( time( NULL ) );
- for(int i=0; i!=100; i++)
- {
- cout<<a+rand()%(b-a+1)<<" ";
- d=a+rand()%(b-a+1);
- s=s+d;
- }
- cout<<endl<<"Suma wylosowanych liczb wynosi: ";
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement