print odd even negative integer count

Solutions on MaxInterview for print odd even negative integer count by the best coders in the world

showing results for - "print odd even negative integer count"
Niclas
12 Jan 2017
1#include<stdio.h>
2int main()
3{
4int n,i,e=0,o=0,ne=0;
5scanf("%d",&n);
6int a[n];
7for(i=0;i<n;i++){
8    scanf("%d",&a[i]);
9if(a[i]<0) ne++;
10else if(a[i]%2==0&&a[i]>=0) e++;
11else o++;
12}
13    printf("%d %d %d",o,e,ne);
14
15}
Sofia
24 Feb 2019
1n,neg,odd,eve,m=int(input()),0,0,0,[int(i) for i in input().split()]
2for i in m:
3    if i<0:
4        neg+=1
5    elif i%2==0 :
6        eve+=1
7    else:
8        odd+=1
9print("{0} {1} {2}".format(odd,eve,neg))