#include <stdio.h>
void comb(int n, int curr, int d, int * sol)
{
if (curr == d)
{
int i;
for (i = 0; i < d; ++i)
printf("%d\t", sol[i]);
printf("\n");
}
else
{
int i;
for (i = n; i >= 1; --i)
{
sol[curr] = i;
comb(i-1, curr+1, d, sol);
}
}
}
int main(void)
{
int temp[10] = {0};
comb(5,0,3,temp);
return 0;
}