求数组所有元素之和
int[] i = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int k=0;
for (int j = 0; j < i.Length; j++)
{
k += i[j];
}
Console.Write(k);
求数组最大数的代码int []a=new int[]{100,800,300,600,700,900,9};
int b = 0;
for (int i = 0; i < a.Length; i++)
if (a[i] > a[0])
{ b = a[i]; }
Console.WriteLine(b);