Professional Documents
Culture Documents
Pset
Pset
#include<stdio.h>
#include<conio.h>
#include<math.h>
// A function to print array element according to the code in the argument list.
int i;
printf("\t{");
if(code[i] == '1')
printf("%d,",arr[i]);
printf("},");
printf(" {");
// It will print the remaining elements which on union forms the superset.
if(code[i] == '0')
{
printf("%d,",arr[i]);
}printf("},\n");
int i, r, l;
char binary[n];
r = pow(2, n-1);
l=n-1;
h:
if(binary[l] == '0')
binary[l] = '1';
else
binary[l] = '0';
l--;
goto h;
int main()
int i, n;
scanf("%d",&n);
int arr[n];
printf("\n");
printf("Enter %d Element:",i+1);
scanf("%d",&arr[i]);
int c=pow(2,n);
printf("\nThe possible subset pairs which on union generates the Powerset, are: \n");
printf("\n {");
GenUnionSet(arr, n);
printf("\n }");
getch();