Created
January 16, 2023 14:30
-
-
Save Titory0/84b89207c8242ed9a2d57ced5e8a9b49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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