用 if then else 在网页中显示出5个数中的最大数和中间数和最小数

来源:百度知道 编辑:UC知道 时间:2024/05/27 08:31:37
用 if then else 在网页中显示出5个数中的最大数和中间数和最小数
怎么弄 高手看下·好的加分

<%
sub ifthen(a,b,c,d,e)
dim m,n,x,i
m=a
n=a
x=a
i=0
if b>a then
m=b
end if
if c>m then
m=c
end if
if d>m then
m=d
end if
if e>m then
m=e
end if
response.write "这最大的数是:"&&"<br>"
if b<n then
n=b
end if
if c<n then
n=c
end if
if d<n then
n=d
end if
if e<n then
n=e
end if
response.write "最小数是:"&n&"<br>"
if b>x then
x=b
end if
if c>x then
x=c
end if
response.write "中间数是:"&x&"<br>"
end sub
%>

楼上的算法有问题,且程序存在小错误!response.write "这最大的数是:"&&"<br>" 少了个m

楼上的用这组数据"20,10,35,8,9"测出的结果是:
这最大的数是:35
最小数是:8
中间数是:35

我的算法如下,用数组加if then进行判断:
<%
Sub Result(a,b,c,d,e)
Dim m(5),temp
m(0)=a