示例#1
0
        static void Main(string[] args)
        {
            int[] arr = new int[] { 1, 2, 3, 5, 6 };

            var result = arr.ArraySum();

            float[] farr = new float[] { 1.0F, 2.0F, 3.0F, 5.0F, 6.0F };

            var fresult = farr.ArraySum();
        }
示例#2
0
        private static void FloatArrayProcessing()
        {
            ArrayLength();
            float[] floatArr = new float[length];
            for (int i = 0; i < floatArr.Length; i++)
            {
                floatArr[i] = Convert.ToSingle(Math.Round(SingleRandom.Next(-1000, 1000) + SingleRandom.NextDouble(), 3));
            }

            ConsolePrintArray(floatArr);
            float floatSum = floatArr.ArraySum();

            Console.WriteLine($"Sum of elements in array: {floatSum.ToString()}");
        }