#include<conio.h>
#include<stdio.h>
#define max 100
void seperate(int[],int);
void main()
{
int a[max],i,n;
printf("Enter the limit of array: ");
scanf("%d",&n);
printf("Enter the elements: ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
seperate(a,n);
getch();
}
void seperate(int a[max],int l)
{
int p[max],x=-1,n[max],y=-1,z[max],w=-1,i=0;
for(i=0;i<l;i++)
{
if(a[i]>0)
{
x++;
p[x]=a[i];
}
else
{
if(a[i]<0)
{
y++;
n[y]=a[i];
}
else
{
w++;
z[w]=a[i];
}
}
}
if(x>=0)
{
printf("\nThe positive array is: ");
for(i=0;i<x+1;i++)
{
printf("%d ",p[i]);
}
}
else
{
printf("\nArray is not have any positive value");
}
if(y>=0)
{
printf("\nThe negative array is: ");
for(i=0;i<y+1;i++)
{
printf("%d ",n[i]);
}
}
else
{
printf("\nArray does not have any negative value");
}
if(w>=0)
{
printf("\nThe zeros in array is: ");
for(i=0;i<w+1;i++)
{
printf("%d ",z[i]);
}
}
else
{
printf("\nArray does not have any zeros value");
}
}