Skip to content

Instantly share code, notes, and snippets.

@Titory0
Created January 16, 2023 14:30
Show Gist options
  • Save Titory0/84b89207c8242ed9a2d57ced5e8a9b49 to your computer and use it in GitHub Desktop.
Save Titory0/84b89207c8242ed9a2d57ced5e8a9b49 to your computer and use it in GitHub Desktop.
public static void ft_print_comb2(int n)
{
for(int i=0;i<Math.Pow(10,n);i++)
{
string chara=i.ToString();
while (chara.Length < n)
{
chara='0'+chara;
}
string used = "";
bool faitpasser=true;
for(int x=0;x<n;x++)
{
for(int y=0; y<used.Length;y++)
{
if (chara[x]==used[y])
{
faitpasser=false;
}
}
used=used+chara[x];
if(x!=0)
{
if(chara[x]<chara[x-1])
{
faitpasser=false;
}
}
}
if ((faitpasser))
{
chara= " "+chara+" ;";
Console.Write(chara);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment