Simple:
Copy Code code 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): WinForm Edition
Copy Code code as follows:
Using System;
Using System.Collections.Generic;
Namespace Zuheshu
{
Class Program
{
static void Main (string[] args)
{
Program P = new program ();
Console.WriteLine ("****************************** combination number ***********************************");
Console.WriteLine ("Please enter an integer at any:");
String num = Console.ReadLine ();
try {
Long. Parse (num);
List<string> als = new list<string> ();
als = P.getdata (string. Empty, Num. Trim (), ALS);
P.display (ALS);
Console.WriteLine ("\ny-enter: Continue");
if (Console.ReadLine (). Trim (). ToLower () = = "Y")
{
Console.clear ();
Main (args);
}
}
catch {
Console.clear ();
Console.WriteLine ("Please enter a number!") ");
Main (args);
}
}
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 ("No other combination of these numbers");
}
Else
{
Console.WriteLine ("Different combinations of the number of total" + A + ", as follows");
foreach (string number in Dals)
{
Console.Write (number + "T");
if (i++% 5 = 0)
{
Console.WriteLine ();
}
}
}
}
}
}