Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- void tab(int a,int b)
- { int p=1,k=100,ilosc=0,tab[a][b];
- float suma=0;
- for(int i=0;i<a;i++)
- {
- for(int j=0;j<b;j++)
- { tab[i][j]=p+rand()%(k-p+1);
- suma=suma+tab[i][j];
- ilosc=ilosc+1;}}
- cout<<"Suma teblicy wynosi: "<<suma<<endl;
- cout<<"Srednia tablicy wynosi: "<<suma/(a*b)<<endl;
- cout<<"Ilosc tablicy wynosi: "<<ilosc<<endl;}
- int main()
- {
- int w,k;
- cout<<"Podaj ilosc wierszy: ";
- cin>>w;
- cout<<"Podaj ilosc kolumn: ";
- cin>>k;
- tab(w,k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement