Discussion:
vb newbie help q2
(too old to reply)
Steve
2003-09-17 10:59:14 UTC
Permalink
Hi all i am wondering how i would go about writing code to do long division
and show a remainder (instead of a decimal point).

thanks
steve
Dan Shelby
2003-09-25 02:44:53 UTC
Permalink
this can be done as follows:
dim divisor as single, dividend as single
dim quotient as single, remainder as single
'assume that value to be divided is in txtdividend.text
'assume that value to divide by is in txtdivisor.text
divisor = val(txtdivident.text)
dividend = val(txtdividend.text)
quotient = int(dividend/divisor)
remainder = dividend - quotient * divisor
'there may well be an easier way to do it but this works.
Post by Steve
Hi all i am wondering how i would go about writing code to do long division
and show a remainder (instead of a decimal point).
thanks
steve
Steve
2003-09-28 10:07:27 UTC
Permalink
thanks for your help. i will give it a try
Post by Dan Shelby
dim divisor as single, dividend as single
dim quotient as single, remainder as single
'assume that value to be divided is in txtdividend.text
'assume that value to divide by is in txtdivisor.text
divisor = val(txtdivident.text)
dividend = val(txtdividend.text)
quotient = int(dividend/divisor)
remainder = dividend - quotient * divisor
'there may well be an easier way to do it but this works.
Post by Steve
Hi all i am wondering how i would go about writing code to do long
division
Post by Steve
and show a remainder (instead of a decimal point).
thanks
steve
Loading...