"Write a program in C to create two sets and perform the Symmetric Difference operation." Code Answer's
You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "Write a program in C to create two sets and perform the Symmetric Difference operation." answered properly. Developers are finding an appropriate answer about Write a program in C to create two sets and perform the Symmetric Difference operation. related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like Write a program in C to create two sets and perform the Symmetric Difference operation.. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on Write a program in C to create two sets and perform the Symmetric Difference operation..
Write a program in C to create two sets and perform the Symmetric Difference operation.
#include <stdio.h>
int main()
{
int a[50], b[50], c[50], fl = 0;
int i, j, n, m, k;
printf("Enter the number of elements in first set:\n");
scanf("%d", &n);
printf("Enter the elements:\n");
for (i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
printf("\nElement of First set:\n");
for (i = 0; i < n; i++)
{
printf("%d\t", a[i]);
}
printf("\nEnter the number of elements in second set:\n");
scanf("%d", &m);
printf("\nEnter the elements:\n");
for (i = 0; i < m; i++)
{
scanf("%d", &b[i]);
}
printf("\nElement of Second set:\n");
for (i = 0; i < m; i++)
{
printf("%d\t", b[i]);
}
k = 0;
for (i = 0; i < n; i++)
{
fl = 0;
for (j = 0; j < m; j++)
{
if (a[i] == b[j])
{
fl = 0;
break;
}
else
{
fl = 1;
}
}
if (fl == 1)
{
c[k] = a[i];
k++;
}
}
for (i = 0; i < m; i++)
{
fl = 0;
for (j = 0; j < n; j++)
{
if (b[i] == a[j])
{
fl = 0;
break;
}
else
fl = 1;
}
if (fl == 1)
{
c[k] = b[i];
k++;
}
}
printf("\nSymmetric Difference: ");
for (i = 0; i < k; i++)
{
if (c[i] != c[i + 1])
{
printf("%d\t,", c[i]);
}
}
return 0;
}
All those coders who are working on the TypeScript based application and are stuck on Write a program in C to create two sets and perform the Symmetric Difference operation. can get a collection of related answers to their query. Programmers need to enter their query on Write a program in C to create two sets and perform the Symmetric Difference operation. related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Write a program in C to create two sets and perform the Symmetric Difference operation. for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of Write a program in C to create two sets and perform the Symmetric Difference operation. while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "Write a program in C to create two sets and perform the Symmetric Difference operation.". Visit this developer's friendly online web community, CodeProZone, and get your queries like Write a program in C to create two sets and perform the Symmetric Difference operation. resolved professionally and stay updated to the latest TypeScript updates.