PDA

View Full Version : سوال: برنامه ای بنوسید n عدد از کاربر گرفته و بزرگترین و کوچکترین آن را حساب کند ؟



WebConsole
شنبه 21 اردیبهشت 1392, 01:18 صبح
دوستان لطفا راهنمایی کنید این سوال منو خیلی گیج کرده اگه این سوال پاسخ داده بشه بیشتر سوالات دیگه من هم برطرف میشه

باتشکر

man22nam
شنبه 21 اردیبهشت 1392, 01:40 صبح
به چ زبانی؟

setroyd
شنبه 21 اردیبهشت 1392, 02:06 صبح
چه سوالی ! چیزی ننوشتی !

WebConsole
شنبه 21 اردیبهشت 1392, 03:27 صبح
برنامه ای بنوسید n عدد از کاربر گرفته و بزرگترین و کوچکترین آن را حساب کند ؟

m.4.r.m
شنبه 21 اردیبهشت 1392, 11:01 صبح
Option Explicit
Private intArray(1 To 10) As Integer
Private lngIndex As Long
Private Sub cmdDone_Click()
Unload Me
End Sub

Private Sub Command1_Click()
Dim max, min As Integer
For lngIndex = LBound(intArray) To UBound(intArray)
If intArray(lngIndex) > max Then
max = intArray(lngIndex)
End If
If intArray(lngIndex) <= min Then
min = intArray(lngIndex)
End If
Next lngIndex
MsgBox max
MsgBox min

End Sub

Private Sub Form_Load()
For lngIndex = LBound(intArray) To UBound(intArray)
intArray(lngIndex) = Int(99 * Rnd + 1)
Next lngIndex
For lngIndex = LBound(intArray) To UBound(intArray)
lstNumbers.AddItem intArray(lngIndex)
Next lngIndex
End Sub