Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and the display the following data:
• The lowest number in the array
• The highest number in the array
• The total of the numbers in the array
• The average of the numbers in the array
1
Expert's answer
2011-08-01T15:43:28-0400
Module Module1 Private array(20) As Integer
Sub Main() & Console.WriteLine("Enter 20 numbers:") & For i As Integer = 0 To 19 array(i) = Console.ReadLine() & Next & Console.WriteLine("The lowest number in the array: " + Lowestnumberinthearray().ToString()) & Console.WriteLine("The highest number in the array: " + Highestnumberinthearray().ToString()) & Console.WriteLine("The total of the numbers in the array: " + Totalofthenumbers().ToString()) & Console.WriteLine("The average of the numbers in the array: " + Averageofthenumbers().ToString()) & Console.ReadLine() End Sub & #039;'' <summary> & #039;'' Find the highest number in the array & #039;'' </summary> & #039;'' <returns></returns> & #039;'' <remarks></remarks> Private Function Highestnumberinthearray() & Dim low As Integer = array(0) & For i As Integer = 0 To 19 If low < array(i) Then low = array(i) End If & Next & Return low End Function & #039;'' <summary> & #039;'' Find the lowest number in the array & #039;'' </summary> & #039;'' <returns></returns> & #039;'' <remarks></remarks> Private Function Lowestnumberinthearray() & Dim low As Integer = array(0) & For i As Integer = 0 To 19 If low > array(i) Then low = array(i) End If & Next & Return low End Function & #039;'' <summary> & #039;'' Total & #039;'' </summary> & #039;'' <returns></returns> & #039;'' <remarks></remarks> Private Function Totalofthenumbers() & Dim totalnumber As Integer = 0 & For i As Integer = 0 To 19 totalnumber += array(i) & Next & Return totalnumber End Function & #039;'' <summary> & #039;'' Avarage & #039;'' </summary> & #039;'' <returns></returns> & #039;'' <remarks></remarks> Private Function Averageofthenumbers() & Dim Averagenumber As Integer = 0 & For i As Integer = 0 To 19 Averagenumber += array(i) & Next & Return Averagenumber / 20 End Function End Module
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment