Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void print_combinations(int n,int x[n])
- {
- int i, j, k,a,b,c;
- for (i = 0; i < n - 5; i++)
- for (j = i + 1; j < n - 4; j++)
- for (k = j + 1; k < n-3; k++)
- for(a=k+1 ; a< n-2; a++)
- for(b=a+1 ; b< n-1; b++)
- for(c=b+1 ; c< n; c++)
- printf("%d %d %d %d %d %d\n", x[i], x[j], x[k], x[a], x[b], x[c]);
- }
- int main()
- {
- int k,i;
- scanf("%d",&k);
- int arr[14];
- while(k!=0)
- {
- for(i=0; i<k; i++)
- scanf("%d",&arr[i]);
- print_combinations(k,arr);
- printf("\n");
- scanf("%d",&k);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement