Answers for "Print Odd Even Negative Integer Count"

0

Print Odd Even Negative Integer Count

#include<stdio.h>
int main()
{
int n,i,e=0,o=0,ne=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
    scanf("%d",&a[i]);
if(a[i]<0) ne++;
else if(a[i]%2==0&&a[i]>=0) e++;
else o++;
}
    printf("%d %d %d",o,e,ne);

}
Posted by: Guest on July-09-2020
0

Print Odd Even Negative Integer Count

n,neg,odd,eve,m=int(input()),0,0,0,[int(i) for i in input().split()]
for i in m:
    if i<0:
        neg+=1
    elif i%2==0 :
        eve+=1
    else:
        odd+=1
print("{0} {1} {2}".format(odd,eve,neg))
Posted by: Guest on July-09-2020

Python Answers by Framework

Browse Popular Code Answers by Language