Subject: PHP

Count Even and Odd Numbers

Write a PHP function to count the number of even and odd numbers in an array.

Example:
Input: [1, 2, 3, 4, 5]
Output: Even: 2, Odd: 3

Select file or drag and drop

PNG, JPG, SVG

Preview