I am trying to create a method that sums and outputs integers in an array. I understand how to sum the integers, however I am having trouble producing the desired output.
If I pass into the method 8, 3, 3 I need the output to look as follows.
For the list = <8, 3, 3> the sum is: 14
Once again I am familiar with how to sum, I am unfamiliar with how to format this. Here is my method so far...
public static void Sum(params int[] number)
{
int total = 0;
for (int i = 0; i < number.Length; ++i)
{
total = total + number[i];
}
Console.Write("For the list =, the sum of its elements is : {0}.", total);
Console.Write("\n");
}