### FUNCTIONS - ARRAY TYPE

#### Description:

Write a program to find the type of the array using functions. An array is said to be Even if all the elements in the array are even. An array is said to be Odd if all the elements in the array are odd. An array is said to be Mixed if it contains some odd elements and some some even elements. Refer function specifications for the function details. The first argument corresponds to the number of elements in the array. The second argument corresponds to the pointer to an array. The return value of the function should be 1 if the array is Even. The return value of the function should be 2 if the array is Odd. The return value of the function should be 3 if the array is Mixed. Input and Output Format: Input consists of n+1 integers where n corresponds to the number of elements in the array. The first integer corresponds to n and the next n integers correspond to the elements in the array. Assume that the maximum number of elements in the array is 20 Refer sample input and output for formatting specifications. All text in bold corresponds to input and the rest corresponds to output Input: 4 2 18 22 46 Output: The array is Even Test Case 1 Input (stdin) 5 2 4 1 3 5 Expected Output The array is Mixed Test Case 2 Input (stdin) 5 9 7 1 3 5 Expected Output The array is Odd

#### Program :

#include<stdio.h>

int main()

{

int a,i,odd=0,even=0;

scanf("%d",&a);

int ar[a];

for(i=0;i<a;i++)

scanf("%d",&ar[i]);

for(i=0;i<a;i++)

{

if(ar[i]%2==0)

even+=1;

else

odd+=1;

}

if(odd>0 && even==0)

printf("The array is Odd");

else if(odd==0 && even>0)

printf("The array is Even");

else

printf("The array is Mixed");

return 0;

}