Advertisement
Josif_tepe

Untitled

Oct 8th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int N;
  8.     cin >> N;
  9.     int kupeni_proizvodi [N][2];
  10.     for(int i = 0; i < N; i++)
  11.     {
  12.         for(int j = 0; j < 2; j++)
  13.         {
  14.             cin >> kupeni_proizvodi[i][j];
  15.  
  16.         }
  17.     }
  18.     int zelka = 0;
  19.     int morkov = 0;
  20.     for (int i = 0; i < N; i++)
  21.     {
  22.         zelka += kupeni_proizvodi[i][0];
  23.         morkov += kupeni_proizvodi[i][1];
  24.     }
  25.     if (zelka > morkov)
  26.     {
  27.         cout << "zelka" << endl;
  28.         cout << zelka << endl;
  29.     }
  30.     else {cout << "morkov" <<  endl;
  31.     cout << morkov << endl;
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement