Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int arr[1000];
- int n;
- scanf("%d", &n);
- for(int i = 0; i < 1000; i += 1) {
- arr[i] = 0;
- }
- for(int i = 0; i < n; i += 1) {
- scanf("%d", &arr[i]);
- }
- for(int i = 0; i < n; i += 1) {
- if(arr[i] > 0) {
- for(int j = n; j > i; j -= 1) {
- arr[j] = arr[j - 1];
- }
- n += 1;
- arr[i] = 0;
- i += 1;
- }
- }
- for(int i = 0; i < n; i += 1) {
- printf("%d", arr[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement