Nayeemzaman

ppslab

Nov 2nd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n,a[100],b[100],c[100],i,x=0,y=0;
  5.     scanf("%d",&n);
  6.     for(i=0; i<n; i++)
  7.     {
  8.         scanf("%d",&a[i]);
  9.         if(a[i]>0){
  10.             b[x]=a[i];
  11.             x++;
  12.         }
  13.         else if(a[i]<0)
  14.         {
  15.             c[y]=a[i];
  16.             y++;
  17.         }
  18.     }
  19.     printf("Positive = ");
  20.     for(i=0; i<x; i++)
  21.     {
  22.             printf("%d ",b[i]);
  23.     }
  24.     printf("\nNegetive = ");
  25.     for(i=0; i<y; i++)
  26.     {
  27.             printf("%d ",c[i]);
  28.     }
  29. }
Add Comment
Please, Sign In to add comment