Răspuns :
#include <iostream>
using namespace std;
int main() {
int n, v[100], i, k, ap=0;
cout << "Introduceti numarul de elemente din vector : ";
cin >> n;
//Citire
for (i = 0; i < n; i++) {
cout << "\nV[" << i << "] = ";
cin >> v[i];
}
//Citire k :
cout << "Introduceti k : ";
cin >> k;
for (i = 0; i < n; i++) {
if (v[i] >= 0) {
ap = 1;
for (int j = i + 1; j < n; j++) {
if (v[i] == v[j] && v[j] >= 0) {
ap++;
v[j] = -1;
}
}
if (ap == k) cout << v[i] << ", ";
}
}
}