1. Course
  2. Arrays
  3. Mathematical statistics

Mathematical statistics


Last updated: 8/23/2020 Difficulty: Intermediate

Create a program in C# that serves to generate mathematical statistics. The program must store a total of 1000 numerical values with decimals in an array of data and must also have a menu with different options that the user can select. It will run until the user presses the exit option. The program menu must include the following options (1-5):

  • 1. Add
  • 2. Show
  • 3. Search
  • 4. Statistics
  • 5. Exit
Add

In the option to add the user, you can add new values in the data array. Be careful not to exceed 1000 values in the data array.

Show

The view option will show the list of values in a line. There may not be any values yet.

Search

To search for values, you must request a real number from the user and show whether or not it exists in the program. There may not be any values yet.

Statistics

This option will show the user a summary of statistics of the data array values, it must include:

  • Total stored values
  • The total sum of values
  • Average
  • Maximum value and minimum value

Finally, you should consider when the user enters a different option from 1 to 5.

Input

1. Add
2. Show
3. Search
4. Statistics
5. Exit
Enter a option (1-5): 1
7

1. Add
2. Show
3. Search
4. Statistics
5. Exit
Enter a option (1-5): 2

1. Add
2. Show
3. Search
4. Statistics
5. Exit
Enter a option (1-5): 3
6

1. Add
2. Show
3. Search
4. Statistics
5. Exit
Enter a option (1-5): 4

1. Add
2. Show
3. Search
4. Statistics
5. Exit
Enter a option (1-5): 5

Output

7
Not found
Total data: 1
Sum: 7
Average: 7
Min value: 7 
Max value: 7

Solution

Arrays

10 / 11

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Advertising