C Program to Print All Even and Odd numbers in an Array

In this program, take input from the user and print even and odd numbers in an array. if the number is divisible 2 and the remainder is zero then the number is even, otherwise, the number is odd.

#include<stdio.h>
int main()
{
   int arr[30],i,n;
   printf("\n enter the size of array:");
   scanf("%d",&n);
   printf("enter array element:");
   for(i=0;i<n;i++)
   {
     scanf("%d",&arr[i]);
   }
   printf("even number in array are:");
   for(i=0;i<n;i++)
   {
     if(arr[i]%2==0)
       printf("%d\t",arr[i]);
   }
   printf("\nodd number in array are:");
   for(i=0;i<n;i++)
   {
     if((arr[i]%2)!=0)
       printf("%d\t",arr[i]);
   }
   return 0;
}

output

 enter the size of array:9
 enter array element:1 3 6 4 2 5 7 9 8
 even number in array are:6      4       2       8
 odd number in array are:1       3       5       7       9