Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <stdlib.h>
- void funkcija(int * niza, int n) {
- int nova_niza[n + 1];
- int j = 0;
- for(int i = 0; i < n; i++) {
- if(niza[i] >= 0) {
- nova_niza[j] = niza[i];
- j++;
- }
- }
- for(int i = 0; i < n; i++) {
- if(niza[i] < 0) {
- nova_niza[j] = niza[i];
- j++;
- }
- }
- for(int i = 0; i < n; i++) {
- printf("%d ", nova_niza[i]);
- }
- }
- int main(int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- int a[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &a[i]);
- }
- funkcija(a, n);
- return 0;
- }
- /*
- 7
- 7 2 -1 0 -30 2 -15
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement