static void TestaaLaskin() { try { double[] array = { 1.0, 2.0, 3.3, 5.5, 6.3, -4.5, 12.0 }; Console.WriteLine("Summa = " + ArrayCalcs.Sum(array)); Console.WriteLine("Keskiarvo = " + ArrayCalcs.Average(array)); Console.WriteLine("Pienin arvo = " + ArrayCalcs.Min(array)); Console.WriteLine("Suurin arvo = " + ArrayCalcs.Max(array)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Test() { try { double[] array = { 1.0, 2.0, 3.3, 5.5, 6.3, -4.5, 12.0 }; Console.WriteLine(String.Format("{0:Sum: 0.00}", ArrayCalcs.Sum(array))); Console.WriteLine(String.Format("{0:Average: 0.00}", ArrayCalcs.Average(array))); Console.WriteLine(String.Format("Min: " + "{0:0.00}", ArrayCalcs.Min(array))); Console.WriteLine(String.Format("{0:Max: 0.00}", ArrayCalcs.Max(array))); } catch (Exception ex) { Console.WriteLine(ex.Message); } }