write a program to accept 10 integers to an array and perform the below actions
1) Print the elements in descending order
2) find the Min value, Max value entered
3) print the the sum we get after adding all the numbers in the array
static void ArrayCalculate(int[] array)
{
int SumNumbersInArray = 0;
Array.Sort(array);
Array.Reverse(array);
var arr = string.Join(" ", array);
foreach(int i in array)
{
SumNumbersInArray += i;
}
Console.WriteLine($"[{arr}]");
Console.WriteLine($"Min: {array[array.Length - 1]}, Max: {array[0]}");
Console.WriteLine($"Sum of numbers in array: {SumNumbersInArray}");
Comments
Leave a comment