using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ExampleDemo
{
class Program
{
static void Main(string[] args)
{
/*
*面试题描述:
* 1 2 3 4 5 6 7 8 9,对这9个数字进行两两组合,计算出组合结果的个数。
*备注:12组合和21组合属于相同组合。
*/
int count = 9;
string[] strArr = new string[count];
//对数组进行数据填充
for (int i = 0; i < count; i++)
strArr[i] = (i + 1).ToString();
for (int j = 0; j < strArr.Length; j++)
{
for (int k = j + 1; k < strArr.Length; k++)
{
Console.Write(strArr[j] + strArr[k]+" ");
}
Console.WriteLine();
}
}
}
}