#include <stdio.h>
int main() {
int n, i, key, count = 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++) {
}
printf("Enter the number to count: ");
for (i = 0; i < n; i++) {
if (arr[i] == key) {
count++;
}
}
printf("The number %d occurs %d times in the array.\n", key
, count
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBuLCBpLCBrZXksIGNvdW50ID0gMDsKICAgIHByaW50ZigiRW50ZXIgdGhlIHNpemUgb2YgdGhlIGFycmF5OiAiKTsKICAgIHNjYW5mKCIlZCIsICZuKTsKCiAgICBpbnQgYXJyW25dOwogICAgcHJpbnRmKCJFbnRlciAlZCBlbGVtZW50cyBvZiB0aGUgYXJyYXk6XG4iLCBuKTsKICAgIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBzY2FuZigiJWQiLCAmYXJyW2ldKTsKICAgIH0KCiAgICBwcmludGYoIkVudGVyIHRoZSBudW1iZXIgdG8gY291bnQ6ICIpOwogICAgc2NhbmYoIiVkIiwgJmtleSk7CgogICAgZm9yIChpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGlmIChhcnJbaV0gPT0ga2V5KSB7CiAgICAgICAgICAgIGNvdW50Kys7CiAgICAgICAgfQogICAgfQoKICAgIHByaW50ZigiVGhlIG51bWJlciAlZCBvY2N1cnMgJWQgdGltZXMgaW4gdGhlIGFycmF5LlxuIiwga2V5LCBjb3VudCk7CiAgICByZXR1cm4gMDsKfQo=