Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n,end,newE;
- cin >> n >> end >> newE;
- int *a = new int[2*n];
- for (int i = 0; i < n; i++){
- cin >> a[i];
- }
- for (int i = 0; i < n; i++){
- if(a[i] % 10 == end){
- cout << i << endl;
- for(int j = n ; j > i +1; j--){
- a[j+1] = a[j];
- }
- a[i+1] = newE;
- n++;
- i++;
- }
- for (int i = 0; i < n; i++){
- cout << a[i] << '\t';
- }
- cout << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment