نازك (١)
نازك (١)
نازك (١)
int main() {
int n;
cout << "Enter the number of
elements in the array: ";
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cout << "Enter element " <<
i+1 << ": ";
cin >> arr[i];
}
int main() {
int n;
cout << "Enter the number of
elements in the array: ";
cin >> n;
int arr[n];
cout << "Enter " << n << "
integers:" << endl;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int negativeOddCount = 0;
unordered_set<int> uniqueSet;
for (int i = 0; i < n; i++) {
if (arr[i] < 0 && arr[i] % 2 != 0) {
negativeOddCount++;
}
uniqueSet.insert(arr[i]);
}
int uniqueCount =
uniqueSet.size();
cout << "The number of negative
odd elements is: " <<
negativeOddCount << endl;
cout << "The number of unique
elements is: " << uniqueCount <<
endl;
return 0;
}
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> originalStack;
stack<int>
multiplesOfThreeStack;
stack<int> primeStack;
int n;
cout << "Enter the number of
elements to add to the stack: ";
cin >> n;