Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int N = 3;
- int A[10];
- void print_bin()
- {
- int i;
- for(i = 0; i < N; i++)
- printf("%d", A[i]);
- printf("\n");
- }
- void bin_gen(int index)
- {
- if(index >= N)
- {
- print_bin();
- return;
- }
- A[index] = 0;
- bin_gen(index+1);
- A[index] = 1;
- bin_gen(index+1);
- }
- int main()
- {
- bin_gen(0);
- }
Add Comment
Please, Sign In to add comment