如果我有1到100位数,我应该得到输出
1--100
2--99
3--98
.
..
..
49---50
Run Code Online (Sandbox Code Playgroud)
代码低于其给定索引的范围,数组不需要很多维度
static void Main(string[] args)
{
//// A. 2D array of strings.
string[][] a = new string[100][];
int bound0 = a.GetUpperBound(0);
int bound1 = a.GetUpperBound(1);
for (int i = 0; i <= bound0; i++)
{
for (int x = 100; x <= bound1; x--)
{
string s1 = a[i][x];
Console.WriteLine(s1);
}
}
Console.WriteLine();
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud) c# ×1