Hi Thomas,
try this logic..
dim n(9)
dim smalln
dim i
n(1)=2
n(2)=4
n(3)=5
n(4)=6
n(5)=1
n(6)=8
n(7)=5
n(8)=6
n(9)=4
smalln=n(1)
for i=2 to ubound
if n(i) < smalln then
smalln=n(i)
end if
next
msgbox cstr(smalln)
logic is
assign first nbr as smallest and loop thru all nbrs and if any nbs is less then smalln then assign that nbr to smalln.
hi,thank for the solution,i hope it work!
anyway,what if the number if given by the the users itself.
i mean the users key the number in instead of we putting it in.
If possible,please ans as soon as possible.
thank you very much.
hi,
u can take input from user by input box like this..
Dim n, temp, i, totaln
totaln = InputBox("Enter how many nbrs are there "
ReDim n(totaln - 1)
For i = 0 To totaln - 1
n(i) = CInt(InputBox("Enter nbr :" + CStr(i + 1)))
Next
dim smalln
smalln=n(1)
for i=2 to ubound
if n(i) < smalln then
smalln=n(i)
end if
next
To Mr AnilKumar
let say if there is two tables.
one is input table while the other is output table.
The user is to key in the 9 numbers in the input table in a 3 by 3 form.
I had already name the input table which a box is given a name each.
This is the same for the output table.
However,i was unable to call out the answer in the output table.
Also,i have a submit button given to it.This is for the users to press after he/she had key in the number.
Pls reply as soon as possible.
Thank you very much
This is my script.
can u tell me where is the error,except that this time the table is 2 by 2.And that the output table consist of only 1 output.
************************************************************
<script language="VBScript">
dim n(4)
dim smalln
dim i
dim mean(1)
sub ShowButton_OnClick
Next
For a=1 to 4
If no(a)="" Then
no(a)=""
Else
no(a)=CLng(no(a))
End If
Next
Hi ,
I could see only problem will be in this para..
sub ShowButton_OnClick
Next
For a=1 to 4
If no(a)="" Then
no(a)=""
Else
no(a)=CLng(no(a))
End If
Next
why u r using 2 arrays no and n , u can validate input like..
sub ShowButton_OnClick
if txtno1.value = "" then
n(0)=0
else
n(0)=clng(txtno1.value)
end if
if txtno2.value = "" then
n(1)=0
else
n(1)=clng(txtno2.value)
end if
if txtno3.value = "" then
n(2)=0
else
n(2)=clng(txtno3.value)
end if
if txtno4.value = "" then
n(3)=0
else
n(3)=clng(txtno4.value)
end if
I think < and > function don't works in case of string.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.