Intersection of Two Sets
Initialize
Enter Elements
Set A :
*Please enter only number,integer and non-repeating values.
Set B :
*Please enter only number,integer and non-repeating values.
Code Execution Step
  • #include<stdio.h>
  • int main()
  •   {
  •   int setA[n1],setB[n2],flag=0,n1=,n2=,i,j;
  •   printf("Intersection=");
  •   for(i=0 ; i< ; i++)
  •     {
  •     for(j=0 ; j< ; j++)
  •             {
  •             if(setA[i] == setB[j])
  •               {
  •                 flag = 1;
  •               }
  •             }
  •             if(flag == 1)
  •               {
  •                 printf("%d",setB[j]);
  •               }
  •           flag = 0;
  •       }
  •  return 0;
  • }
Code Output Screen
Comparing
Found

Set A =
{}
Set B =
{}

i:
   j:
   flag:
0
{
}
Ո
{
}

Intersection =
{}
Intersection Is Done
Nothing Is Common