### Print positive and negative numbers using One Dimensional Array in C

This program is about checking and print the numbers in array according to positive or negative using for loops and if conditions.

#### Source Code

```#include<stdio.h>
int main()
{
int i,j,a[10],n,m,b=0,c=0;
printf("\nEnter the limit:");
scanf("%d",&n);
printf("\nEnter the values:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nGiven values are:");
for(i=0;i<n;i++)
{
printf("\na[%d]=%d",i,a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]>0)
{
printf("\nPositive value a[%d]=%d",i,a[i]);
c++;
}
else
{
printf("\nNegative value a[%d]=%d",i,a[i]);
b++;
}
}
printf("\nNo of positive numbers:%d",c);
printf("\nNo of negative numbers:%d",b);
return 0;
}

```

#### Output

```Enter the limit:5
Enter the values:-3
1
-6
4
-2
Given values are:
a[0]=-3
a[1]=1
a[2]=-6
a[3]=4
a[4]=-2
Negative value a[0]=-3
Positive value a[1]=1
Negative value a[2]=-6
Positive value a[3]=4
Negative value a[4]=-2
```

Learn All in Tamil © Designed & Developed By Tutor Joes