Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- const int MAX_SIZE = 99;
- int numbers1[MAX_SIZE]{};
- int numbers2[MAX_SIZE]{};
- int arrSize, sum = 0;
- cin >> arrSize;
- for (int i = 0; i < arrSize; i++) {
- cin >> numbers1[i];
- }
- for (int i = 0; i < arrSize; i++) {
- cin >> numbers2[i];
- }
- for (int i = 0; i < arrSize; i++) {
- if (numbers1[i] != numbers2[i]) {
- cout << "Arrays are not identical. Found difference at " << i << " index.\n";
- return 0;
- }
- sum += numbers1[i];
- }
- cout << "Arrays are identical. Sum: " << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement