programm to find number of even numbers code example
Example 1: c code for even numbrrs
#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
// True if num is perfectly divisible by 2
if(num % 2 == 0)
printf("%d is even.", num);
else
printf("%d is odd.", num);
return 0;
}
Example 2: 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))