data配列のインデックスの最小値をだしたのですが、実行すると0が返ってきてうまくだすことができません。
よろしくお願い致します。
実行結果
最小値は1です。
Module Module1
Sub Main() Dim data As Integer() = {2, 4, 7, 8, 3, 4, 5, 1, 2, 3, 7, 3, 6, 7, 2, 6, 3, 8, 3, 1, 7, 1, 9, 3, 5, 3, 6, 7, 3, 9} Console.WriteLine("最小値は" + CStr(Total(data)) + "です。") Console.ReadLine() End Sub Private Function Total(ByVal number As Integer()) As Integer Dim min As Integer = 0 For i As Integer = 0 To number.Length - 1 If number(i) < min Then min = number(i) End If Next Return min End Function
End Module
回答2件
あなたの回答
tips
プレビュー