Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB Script for '/' and 'mod'
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Excellent idea Ankesh.

But it looks like it will give correct results only if intVar1 > intVar2.
Say my requirement is to find the Quotient & reminder for 3 / 8.
I would expect Quotient to be 0 and Reminder to be 3.
But it will return 1 and -5.
so..there is a small correction...i think it will work for all...

Code:
intVar1 = 3
intVar2 = 8

intQuotient = 0

While intVar1 >= intVar2
          intVar1=intVar1-intVar2
          intQuotient=intQuotient+1
Wend

msgbox "Quotient=" & intQuotient
msgbox "Reminder=" & intVar1
Reply


Messages In This Thread
VB Script for '/' and 'mod' - by sandya.qtp - 10-13-2011, 11:53 AM
RE: VB Script for '/' and 'mod' - by Ankesh - 10-17-2011, 05:44 PM
RE: VB Script for '/' and 'mod' - by vIns - 10-18-2011, 04:53 AM
RE: VB Script for '/' and 'mod' - by Ankesh - 10-18-2011, 10:19 AM
RE: VB Script for '/' and 'mod' - by sandya.qtp - 10-18-2011, 11:58 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)