#include <stdio.h>
int main() {
int n, i, even = 0, odd = 0, positive = 0, negative = 0;
printf("Enter the size of the array: ");
int arr[n];
printf("Enter %d elements of the array:\n", n
); for (i = 0; i < n; i++) {
// Check for even and odd
if (arr[i] % 2 == 0) {
even++;
} else {
odd++;
}
// Check for positive and negative
if (arr[i] > 0) {
positive++;
} else if (arr[i] < 0) {
negative++;
}
}
printf("Even: %d\nOdd: %d\nPositive: %d\nNegative: %d\n", even
, odd
, positive
, negative
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBuLCBpLCBldmVuID0gMCwgb2RkID0gMCwgcG9zaXRpdmUgPSAwLCBuZWdhdGl2ZSA9IDA7CiAgICBwcmludGYoIkVudGVyIHRoZSBzaXplIG9mIHRoZSBhcnJheTogIik7CiAgICBzY2FuZigiJWQiLCAmbik7CgogICAgaW50IGFycltuXTsKICAgIHByaW50ZigiRW50ZXIgJWQgZWxlbWVudHMgb2YgdGhlIGFycmF5OlxuIiwgbik7CiAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgc2NhbmYoIiVkIiwgJmFycltpXSk7CgogICAgICAgIC8vIENoZWNrIGZvciBldmVuIGFuZCBvZGQKICAgICAgICBpZiAoYXJyW2ldICUgMiA9PSAwKSB7CiAgICAgICAgICAgIGV2ZW4rKzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBvZGQrKzsKICAgICAgICB9CgogICAgICAgIC8vIENoZWNrIGZvciBwb3NpdGl2ZSBhbmQgbmVnYXRpdmUKICAgICAgICBpZiAoYXJyW2ldID4gMCkgewogICAgICAgICAgICBwb3NpdGl2ZSsrOwogICAgICAgIH0gZWxzZSBpZiAoYXJyW2ldIDwgMCkgewogICAgICAgICAgICBuZWdhdGl2ZSsrOwogICAgICAgIH0KICAgIH0KCiAgICBwcmludGYoIkV2ZW46ICVkXG5PZGQ6ICVkXG5Qb3NpdGl2ZTogJWRcbk5lZ2F0aXZlOiAlZFxuIiwgZXZlbiwgb2RkLCBwb3NpdGl2ZSwgbmVnYXRpdmUpOwogICAgcmV0dXJuIDA7Cn0K