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