/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* birds.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rchiorea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/11 12:54:57 by rchiorea #+# #+# */ /* Updated: 2017/02/11 13:09:17 by rchiorea ### ########.fr */ /* */ /* ************************************************************************** */ #include #include #include #include #include #include #include int ft_max(int *tab) { int i; int max; i = 0; max = tab[i]; while (i < 5) { if (max < tab[i]) max = tab[i]; i++; } return (max); } int main(void) { int n; int i; int *birds; int max; birds = (int *)malloc(sizeof(int) * 5); scanf("%d",&n); int *types = malloc(sizeof(int) * n); for(i = 0; i < n; i++) scanf("%d",&types[i]); i = 0; while (i < n) { birds[(types[i] - 1)]++; i++; } max = ft_max(birds); i = 0; while (i < 5) { if (max == birds[i]) { i++; printf("%d", i); return (0); } i++; } return (0); }