Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //6-5-10
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #include <clocale>
- using namespace std;
- int main()
- {
- int n, znak=0, x;
- cin >> n;
- int* arr = new int[n];
- for (int i = 0; i < n; i++)
- cin >> arr[i];
- for (int i = n - 1; i >= 0; i--)
- if (arr[i] % (i + 1) == 0)
- {
- znak = i;
- break;
- }
- cin >> x;
- for (int i = n; i > znak + 1; i--)
- arr[i] = arr[i - 1];
- arr[znak + 1] = x;
- n++;
- for (int i = 0; i < n; i++)
- cout << arr[i] << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement