output
Print a positive integer representing the
count of elements that are not common
to both the lists of integers.
Example
Input:
11.10
11234557 69 10
11 12 13 456 718 19 20
Output:
12
Share
output
Print a positive integer representing the
count of elements that are not common
to both the lists of integers.
Example
Input:
11.10
11234557 69 10
11 12 13 456 718 19 20
Output:
12
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Verified answer
Answer:
yes 12
Step-by-step explanation:
please mark me as brianliest
Program is given below.
Explanation:
#include <iostream>
using namespace std;
int main()
{
int arr1[] = {11, 23, 45, 57, 69, 10},
arr2[] = {11, 12, 23, 45, 57, 69, 10}, i=0, n1, j=0, n2, k=0, count=0;
n1 = sizeof(arr1) / sizeof(arr1[0]);
n2 = sizeof(arr2) / sizeof(arr2[0]);
cout<<"Uncommon elements are: \n";
while (i < n1 && j < n2)
{
// If the elements are not common, it prints smaller
if (arr2[j] < arr1[i]) {
cout << arr2[j] << " ";
k++;
j++;
count++;
}
else if (arr1[i] < arr2[j]) {
cout << arr1[i] << " ";
i++;
k++;
count++;
}
// Skipping the common elements
else {
i++;
j++;
}
}
// As the sizes of the array may differ, we will print the remaining elements with the help of this code.
// For array 1
while (i < n1)
{
cout << arr1[i] << " ";
i++;
k++;
count++;
}
// For array 2
while (j < n2)
{
cout << arr2[j] << " ";
j++;
k++;
count++;
}
cout<<"\nCount of uncommon elements = "<<count;
}
Refer the attached image for output.