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.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
Subsets for given size of k
+1
vote
asked
Jul 30, 2018
by
THARANYA THANGAVEL
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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.
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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.
...