fork download
  1. #include <stdio.h>
  2. void printPowerSet(char *set, int l , int h , int size)
  3. {
  4. int i=l;
  5. for(i=l;i<=h;i++){printf("%c",set[i]);}
  6. printf("\n");
  7. if(l+1 < size){ printPowerSet(set,l+1,h,size); }
  8. if(h-1 >= 0 ){printPowerSet(set,l,h-1,size);}
  9. if( l+1<size && h-1 >=0) {printPowerSet(set,l+1,h-1,size);}
  10. }//printpowerset
  11. int main(void) {
  12. char set[] = {'a','b','c'};
  13. printPowerSet(set,0,2,3 );
  14.  
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 5268KB
stdin
Standard input is empty
stdout
abc
bc
c


b







ab
b





a




b