View difference between Paste ID: KaaJRD60 and arW7KBVf
SHOW: | | - or go back to the newest paste.
1
#include <stdio.h>
2
3
int N = 3;
4
int A[10];
5
6
void print_bin()
7
{
8
	int i;
9
	for(i = 0; i < N; i++)
10
		printf("%d", A[i]);
11
	printf("\n");
12
}
13
14
void bin_gen(int index)
15
{
16
	if(index >= N)
17
	{
18
		print_bin();
19
		return;
20
	}
21
	
22
	
23
	A[index] = 0;
24
	bin_gen(index+1);
25
	
26
	
27
	A[index] = 1;
28
	bin_gen(index+1);	
29
}
30
31
int main()
32
{
33
	bin_gen(0);
34
}