Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <math.h>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int a,b;
- float n,c,srednia;
- srand( time( NULL ) );
- cout<<"Podaj ilosc liczb: ";
- cin>>n;
- cout<<"Podaj poczatek przedzialu: ";
- cin>>a;
- cout<<"Podaj koniec przedzialu: ";
- cin>>b;
- int los;
- for (int i=0;i<n;i++)
- {
- los=rand()%(b-a)+a;
- cout<<los<<" "<<endl;
- c=c+los;
- }
- srednia=c/n;
- cout<<"suma liczb: "<<c<<endl;
- cout<<"srednia liczb: "<<srednia<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement