Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Subsets for given size of k

+1 vote
asked Jul 30, 2018 by THARANYA THANGAVEL

1 Answer

0 votes
answered Aug 2, 2018 by Raju G (370 points)
#include<stdio.h>
int main()
{
  int a[100],i,j,k,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++)
  {
    for(j=i+1;j<n;j++)
    {
      for(k=j+1;k<n;k++)
      printf("%d %d %d\n",a[i],a[j],a[k]);
    }
  }
  return 0;
}
commented Aug 2, 2018 by Raju G (370 points)
It's very easy one.
commented Aug 2, 2018 by THARANYA THANGAVEL
It is only suitable for form subset with size 3.But i need size of k subset. If you giving the value of k is 4 means it only give possible subset which has size 4.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...