### Print odd or even numbers using One Dimensional Array in C

This program is about checking and print the given number is odd or even in an array 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]%2==0)
{
printf("\nEven value:\na[%d]=%d",i,a[i]);
c++;
}
else
{
printf("\nOdd value:\na[%d]=%d",i,a[i]);
b++;
}
}
printf("\nNo of Even numbers:%d",c);
printf("\nNo of Odd numbers:%d",b);
return 0;
}

```

#### Output

```Enter the limit:5
Enter the values:1
2
3
4
5
Given values are:
a[0]=1
a[1]=2
a[2]=3
a[3]=4
a[4]=5
Odd value:
a[0]=1
Even Value:
a[1]=2
Odd value:
a[2]=3
Even Value:
a[3]=4
Odd value:
a[4]=5
No. of Even numbers:2
No. of Odd numbers:3
```

Learn All in Tamil © Designed & Developed By Tutor Joes