-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path25A.c
More file actions
48 lines (43 loc) · 710 Bytes
/
25A.c
File metadata and controls
48 lines (43 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <string.h>
int main()
{
int n,i,even=0,odd=0;
scanf("%d",&n);
int a[n];
for (i=0; i<n; i++)
{
scanf("%d",&a[i]);
if (a[i]%2==0)
{
even++;
}
else
{
odd++;
}
}
if (even>odd)
{
for (i=0; i<n; i++)
{
if (a[i]%2!=0)
{
printf("%d",i+1);
return 0;
}
}
}
else if (odd>even)
{
for (i=0; i<n; i++)
{
if (a[i]%2==0)
{
printf("%d",i+1);
return 0;
}
}
}
return 0;
}