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. 1. Add
  2. 2. Show
  3. 3. Search
  4. 4. Statistics
  5. 5. Exit
  6. Enter a option (1-5): 1
  7. 7
  8.  
  9. 1. Add
  10. 2. Show
  11. 3. Search
  12. 4. Statistics
  13. 5. Exit
  14. Enter a option (1-5): 2
  15.  
  16. 1. Add
  17. 2. Show
  18. 3. Search
  19. 4. Statistics
  20. 5. Exit
  21. Enter a option (1-5): 3
  22. 6
  23.  
  24. 1. Add
  25. 2. Show
  26. 3. Search
  27. 4. Statistics
  28. 5. Exit
  29. Enter a option (1-5): 4
  30.  
  31. 1. Add
  32. 2. Show
  33. 3. Search
  34. 4. Statistics
  35. 5. Exit
  36. Enter a option (1-5): 5

Output

  1. 7
  2. Not found
  3. Total data: 1
  4. Sum: 7
  5. Average: 7
  6. Min value: 7
  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.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising


CookieOwn and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.