Find odd & even numbers using function - C

Write a function isEven, which accepts an integer as parameter and returns 1 if number is even, otherwise 0. Use this function in main to accept n numbers and check if they are even or odd.

Solution:

#include<stdio.h>
int isEven(int n)
{
     if(n%2==0)
          return 1;
     else
          return 0;
}
int main()
{
     int num,ans,i,z;
     printf("/*How Many Numbers You \nWant to Check EVEN or ODD*/\n\nEnter Limit : ");
     scanf("%d",&z);
     for(i=1;i<=z;i++)
     {
          printf("\nEnter Number-%d : ",i);
          scanf("%d",&num);
          ans=isEven(num);
          if(ans==1)
               printf("%d is Even\n",num);
          if(ans==0)
               printf("%d is Odd\n",num);
     }
     return 0;
}


Output:

odd even numbers

Q. Passing array as argument to the function.

Solution:

#include<stdio.h>
void isEven(int n[],int x) //passing array as argument
{
     int j;
     for(j=0;j<x;j++)
     {
          if(n[j]%2==0)
               printf("  %d is Even\n",n[j]);
          else
               printf("  %d is Odd\n",n[j]);
     }
}
int main()
{
     int num[20],i,z;
     printf("/*How Many Numbers \nYou Want to Check EVEN or ODD*/\n\nEnter Limit: ");
     scanf("%d",&z);
     printf("\n  Enter %d Numbers",z);
     printf("\n--------------------\n ");
     /*read an array element up to user entered limit*/
     for(i=0;i<z;i++)
     {
          scanf("%d",&num[i]);
     }
     printf("-----------------------\n");
     isEven(num,z); //Function call
     return 0;
}


Output:

array as argument