Answer to Question #349687 in C# for Sunayana

Question #349687

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


1
Expert's answer
2022-06-10T18:34:18-0400
        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}");

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS