Question: Create a C# Console application that uses two methods: Method 1: Randomly populate an array with integers numbers between 10 and 50. The array length
Create a C# Console application that uses two methods:
Method 1: Randomly populate an array with integers numbers between 10 and 50. The array length is a parameter for the method.
Method 2: Return the summation of all the elements of an array (the array is the parameter for this method).
The program has to follow the instructions below:
Ask the user to enter an integer number between 5 and 15.
Use a try/catch block to validate the users entry.
Use a conditional statement to check the users entry is between 5 and 15.
Use Method 1 to randomly populates an array with a length equal to the users input.
Display in the console all the elements the in the array.
Use Method 2 to sum all the elements in the array from step 4.
Display in the console the value from step 6.
Example:
Input: 5
Output:
The elements of the arrays are: 39 30 34 49 34
The sum is: 186
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
