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