Guest User

Untitled

a guest
Jul 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5.   int k, m, i, k1, m1, i1;
  6.   int a[5], b[5], c[5];
  7.  
  8. int main()
  9. {
  10.     srand(time(NULL));
  11.     for (i=0; i<5; i++)
  12.     {
  13.       a[i]=(-10 + rand() % 15);
  14.     }
  15.          for (i=k=m=0; i<5; i++)
  16.          {
  17.             if (a[i]>=0) {b[k]=a[i];k++;}
  18.             else {c[m]=a[i];m++;}
  19.          }
  20.                 for(i1=0; i1<5; i1++)
  21.                     printf("A[i]=%d,\n", a[i1]);
  22.                 for(i1=0; i1<5; i1++)
  23.                     printf("B[k]=%d,\n", b[i1]);
  24.                 for(i1=0; i1<5; i1++)
  25.                     printf("C[m]=%d,\n", c[i1]);
  26.  
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment