Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Recursion
- {
- class Program
- {
- static void Generate(int index, int[] arr)
- {
- if (index == arr.Length)
- {
- Console.WriteLine(string.Join("", arr));
- }
- else
- {
- for (int i = 0; i <= 1; i++)
- {
- arr[index] = i;
- Generate(index + 1, arr);
- }
- }
- }
- static void Main(string[] args)
- {
- var number = int.Parse(Console.ReadLine());
- var arr = new int[number];
- Generate(0, arr);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement