- sing System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication2
- {
- namespace 求整形数组的和
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] arr = { 2, 3, 5, 6, 8 };
- int sum = 0;
- for (int i = 0; i < arr.Length; i++)
- {
- sum = sum + arr;
- }
- Console.WriteLine("{0}",sum);
- Console.ReadKey();
- }
- }
-
- </p>
复制代码 |