Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int num, num2; // the size of arrays
- cout << "Enter first value: ";
- cin >> num;
- int *A = new int[num];
- int *B = new int[num2];
- int *C = new int[num];
- int count = 0;
- for (int i=0; i< num ; i++){
- cin >> A[i];
- }
- cout << "Enter second value: ";
- cin >> num2;
- for (int j = 0; j<num2; j++){
- cin >> B[j];
- }
- for (int i=0; i< num ; i++){
- int counter = 0;
- for(int j = 0; j< num2; j++){
- if(B[j] == A[i]){
- count ++;
- }
- }
- if(count != 1){
- for (int g = 2; g<= count; g++) {
- if (count % g == 0) {
- counter++;
- }
- }
- if (counter == 1){
- C[i] = A[i];
- count = 0;
- }
- }
- }
- for (int i=0; i< num ; i++){
- if(C[i] != 0){
- cout << C[i];
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement