Advertisement
RamiroAlegre

Untitled

Aug 31st, 2021
1,198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int array1[3] = { 10 ,2, 8 };
  8.     int array2[3] = { 0 ,2, 10 };
  9.  
  10.     int acu1, acu2;
  11.     acu1 = acu2 = 0;
  12.  
  13.     for (int i = 0; i <= 2; i++) {
  14.         acu1 += array1[i];
  15.         acu2 += array2[i];
  16.     }
  17.  
  18.     if (acu1 > acu2) {
  19.         cout << "El array mas grande es el 1";
  20.     }
  21.     else {
  22.         cout << "El array mas grande es el 2";
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement