随机输入6个数值,放入一个2行3列的二维数组中,计算并输出最小值
2个回答
展开全部
#include <stdio.h>
int main()
{
int a[2][3];
int i,j;
for(i=0;i<=1;i++)
{
for(j=0;j<=2;j++)
{
scanf("%d",&a[i][j]);
}
}
int min_num=a[0][0];
for(i=0;i<=1;i++)
{
for(j=0;j<=2;j++)
{
if(a[i][j]<min_num)
{
min_num=a[i][j];
}
}
}
printf("最小值是:%d",min_num);
return 0;
}
展开全部
Private Sub Form_Click()
Dim A(1 To 2, 1 To 3) As Double, vMin As Double
For i = 1 To 2
For j = 1 To 3
A(i, j) = Val(InputBox("请输入第" & i & "行,第" & j & "列的数字:"))
If i + j = 2 Then
vMin = A(i, j)
Else
If vMin > A(i, j) Then vMin = A(i, j)
End If
Print A(i, j),
Next
Print
Next
Print "最小的数是:" & vMin
End Sub
Dim A(1 To 2, 1 To 3) As Double, vMin As Double
For i = 1 To 2
For j = 1 To 3
A(i, j) = Val(InputBox("请输入第" & i & "行,第" & j & "列的数字:"))
If i + j = 2 Then
vMin = A(i, j)
Else
If vMin > A(i, j) Then vMin = A(i, j)
End If
Print A(i, j),
Next
Next
Print "最小的数是:" & vMin
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询