Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- main()
- {
- int n, i = 0;
- cout << "Enter n (size of arrays): ";
- cin >> n;
- cout << "Enter array a[" << n << "]:\n";
- /* for MVS Compiler
- int* a = new int [n];
- int* b = new int [n]; */
- int a[n], b[n];
- for(; i < n; i++)
- cout << " - a[" << i + 1 << "] = ",
- cin >> a[i];
- cout << "\nEnter array b[" << n << "]:\n";
- for(i = 0; i < n; i++)
- cout << " - b[" << i + 1 << "] = ",
- cin >> b[i];
- cout << "\nNow we'll count difference:\n";
- for(i = 0; i < n; i++)
- cout << " - Step " << i + 1 << ", difference: " << abs(a[i] - b[i]) << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment