Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can I get the highest and lowest number when i enter 5 numbers and get the sum of it and after, the average of 5 numbers using vb.net..help me..Thank You!!
Posted
Updated 6-Aug-12 3:20am
v2
Comments
bbirajdar 6-Aug-12 9:18am    
How are you going to learn if you get the homework done by somebody else ?

you should use 'for loop' and 'math' functions to solve this.

Happy Coding!
:)
 
Share this answer
 
Comments
bbirajdar 6-Aug-12 9:19am    
Correct solution for the homework question +5.. The OP needs guidance and not code...
Aarti Meswania 6-Aug-12 9:21am    
thank you :)
Dim iArray() As Integer = {10, 30, 50, 40, 20}

Dim iSum As Integer = 0

Dim iLowerNumber As Integer = iArray(0)

Dim iHeighest As Integer = iArray(0)

For index As Integer = 0 To iArray.Length - 1

iSum += iArray(index)

If iLowerNumber > iArray(index) Then
iLowerNumber = iArray(index)


End If

If iHeighest < iArray(index) Then
iHeighest = iArray(index)
End If

Next


Dim iAverage As Double = iSum / 5


Label1.Text = " Lowest Number ==" + iLowerNumber.ToString() + " Hiest Number == " + iHeighest.ToString() + " Sum of the Numbers == " + iSum.ToString() + " Average of the Numbers == " + iAverage.ToString()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900