JakubJaneczek

Zadanie 12

Apr 30th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5. int a,b,w,k;
  6. float e,c,d;
  7.  
  8.  
  9.  
  10. int main()
  11. {
  12.     cin >> w;
  13.     cin >> k;
  14.     c=0;
  15.     d=0;
  16.     int tab[w][k];
  17.     for (int a=0; a<w; a++)
  18.     {
  19.         for (int b=0; b<k; b++)
  20.         {
  21.             tab[a][b]=1+rand()%(100);
  22.             c=c+tab[a][b];
  23.             d++;
  24.         }
  25.     }
  26.     e=c/d;
  27.     cout << "suma: " << c << ", ilosc: " << d << ", srednia: " << e;
  28.     return 0;
  29. }
Add Comment
Please, Sign In to add comment