Previous Next
0 / 21
Module DEMO-32-106DEMO-C-32

Count Even and Odd Numbers

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a C program to count the number of even and odd integers in a 1D array. Input the size n and then n integers. The program should output the count of even numbers and the count of odd numbers on separate lines.

Example

Input:

5 1 2 3 4 5

Output:

Even: 2 Odd: 3

Constraints

1 <= n <= 100

Input Format

n followed by n integers

Output Format

Two lines with counts

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5
1 2 3 4 5
Even: 2
Odd: 3
2, 4 are even (2). 1, 3, 5 are odd (3).
Sample #2
Public sample
3
1 3 5
Even: 0
Odd: 3
All odd.
Sample #3
Public sample
4
0 -2 -5 1
Even: 2
Odd: 2
0 and -2 are even. -5 and 1 are odd.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings