vb 编写一个求2个数中最小值min的过程,然后用这个过程求4个数中的最小值
1个回答
展开全部
input
"n=";n
dim
a[n]
as
integer
for
i=1
to
n
input
a[i]
next
i
dim
max
as
integer
dim
min
as
integer
max=a[1]
mix=a[1]
for
i=2
to
n
if
max<a[i]
then
max=a[i]
next
i
for
i=2
to
n
if
min>a[i]
then
min=a[i]
next
i
print
"最大值为:"
&
max
&
",最小值:"
&
min
end
这个可以根据你输入的个数,再输入对应的值求出最大值和最小值
"n=";n
dim
a[n]
as
integer
for
i=1
to
n
input
a[i]
next
i
dim
max
as
integer
dim
min
as
integer
max=a[1]
mix=a[1]
for
i=2
to
n
if
max<a[i]
then
max=a[i]
next
i
for
i=2
to
n
if
min>a[i]
then
min=a[i]
next
i
"最大值为:"
&
max
&
",最小值:"
&
min
end
这个可以根据你输入的个数,再输入对应的值求出最大值和最小值
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询