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 w,k,a=1,b=100;
- float sr,s,p=0;
- cout << "Podaj ilosc wierszy: ";
- cin >> w;
- cout << "Podajk ilosc kolumn: ";
- cin >> k;
- int tab[w][k];
- for(int i=0;i<w;i++)
- {
- for(int j=0;j<k;j++)
- {
- tab[i][j]=a+rand()%(b-a+1);
- s=s+tab[i][j];
- p=p+1;
- }
- }
- sr=s/p;
- cout << "Lacznych elementow: " << p << "\nSuma: " << s << "\nSrednia: " << sr;
- return 0;
- }
Add Comment
Please, Sign In to add comment