mitkonikov

prosek

Dec 1st, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int uchenici = 23;
  8.     int predmeti = 12;
  9.  
  10.     int a[uchenici][predmeti] = {};
  11.  
  12.     for (int i = 0; i < uchenici; i++) {
  13.         for (int j = 0; j < predmeti; j++) {
  14.             cin >> a[i][j];
  15.         }
  16.     }
  17.  
  18.     int prosek = 0;
  19.     for (int i = 0; i < uchenici; i++) {
  20.         // tava e zbir na ocenkite na edno dete
  21.         int zbir = 0;
  22.         for (int j = 0; j < predmeti; j++) {
  23.             zbir += a[i][j];
  24.         }
  25.  
  26.         prosek += zbir / predmeti;
  27.     }
  28.  
  29.     prosek = prosek / uchenici;
  30.  
  31.     // prosek na klaso
  32.     cout << prosek << endl;
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment