Simple:
CopyCode The Code is as follows: public partial class _ default: system. Web. UI. Page
{
String M1 = "";
Protected void page_load (Object sender, eventargs E)
{
String n = "123 ";
String M = "";
Zuhe (N );
For (Int J = 2; j>-1; j --)
{
M = m + n [J];
}
Zuhe (m );
}
Private void zuhe (string SSEL)
{
For (INT I = 0; I <SSEL. length; I ++)
{
M1 = SSEL + SSEL. substring (I, 1 );
Response. Write (m1.remove (I, 1) + "<br> ");
}
}
}
Csdn (xiaoshen1127): winformCopy codeThe Code is as follows: using system;
Using system. Collections. Generic;
Namespace zuheshu
{
Class Program
{
Static void main (string [] ARGs)
{
program P = new program ();
console. writeline ("******************************* number of combinations ***** ******************************");
console. writeline ("enter any integer:");
string num = console. readline ();
try {
long. parse (Num);
List als = new list ();
als = P. getdata (string. empty, num. trim (), als);
P. display (ALS);
console. writeline ("\ NY-Enter: continue");
If (Console. readline (). trim (). tolower () = "Y")
{< br> console. clear ();
main (ARGs);
}< BR >}< br> catch {
console. clear ();
console. writeline ("enter a number! ");
main (ARGs);
}< BR >}
Private list <string> getdata (string strbase, string strsel, list <string> alret)
{
If (strsel. Length = 1)
{
String temp = strbase + strsel;
If (! Alret. Contains (temp )&&! Temp. startswith ("0 "))
{
Alret. Add (temp );
}
}
Else
{
For (INT I = 0; I <strsel. length; I ++)
{
Getdata (strbase + strsel. substring (I, 1), strsel. Remove (I, 1), alret );
}
}
Return alret;
}
Public void display (list <string> Dals)
{
Int I = 1;
Int A = Dals. count;
If (A = 0)
{
Console. writeline ("this number has no other combinations ");
}
Else
{
Console. writeline ("Total number of different combinations" + A + ", as shown below ");
Foreach (string number in Dals)
{
Console. Write (number + "\ t ");
If (I ++ % 5 = 0)
{
Console. writeline ();
}
}
}
}
}
}