All pastes #1759263 Raw Edit

Nitish

public text v1 · immutable
#1759263 ·published 2010-01-20 19:01 UTC
rendered paste body
#include <stdio.h>int arr[20], aindex = 1; // using arr[] as a stackint max = 10;void disp(int d, int start){	int i, j;		if(d == 1)		for(i=start; i<max; i++)		{			for(j=1; j<aindex; j++) // print all elements in arr[] before i				printf("%d ", arr[j]);			printf("%d \n", i);					}		else	{		arr[aindex++] = start;				i = 1;				disp(d-1, start+i);			while(i <= (max-d))		{						aindex = aindex - (d-1);			arr[aindex++]++;						i++;						disp(d-1, start+i);						}	}}int main(){		disp(5, 1);	// pass the value instead of '5'	return 0;}