Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int tab[10][10];
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 10; j++) {
- tab[i][j] = rand();
- cout << tab[i][j] << " ";
- }
- cout << endl;
- }
- int max = 32*8;
- int min=32*8;
- int avg=0;
- int counter=0;
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 10; j++) {
- if (tab[i][j] > max) {
- max = tab[i][j];
- }
- if (tab[i][j] < min) {
- min = tab[i][j];
- }
- }
- }
- for (int a = 0; a < 10; a++) {
- for (int b=0; b < 10; b++) {
- avg = avg + tab[a][b];
- counter++;
- }
- }
- cout <<"Max value is "<< max<<endl;
- cout << "Min value is " << min << endl;
- cout << "Avg value is " << avg / counter;
- cout << endl << endl << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement