Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int k, m, i, k1, m1, i1;
- int a[5], b[5], c[5];
- int main()
- {
- srand(time(NULL));
- for (i=0; i<5; i++)
- {
- a[i]=(-10 + rand() % 15);
- }
- for (i=k=m=0; i<5; i++)
- {
- if (a[i]>=0) {b[k]=a[i];k++;}
- else {c[m]=a[i];m++;}
- }
- for(i1=0; i1<5; i1++)
- printf("A[i]=%d,\n", a[i1]);
- for(i1=0; i1<5; i1++)
- printf("B[k]=%d,\n", b[i1]);
- for(i1=0; i1<5; i1++)
- printf("C[m]=%d,\n", c[i1]);
- return 0;
- }
Add Comment
Please, Sign In to add comment