Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, v[1000];
- cin >> n;
- int i = 0, j = 0;
- while (i < n)
- {
- int x;
- cin >> x;
- if (x)
- {
- v[j] = x;
- j++;
- }
- i++;
- }
- while (j < n)
- {
- v[j] = 0;
- j++;
- }
- for (int i = 0; i < n; i++)
- cout << v[i] << ' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement