446,383 Members | 2,063 Online Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

# Whole Numbers

 P: n/a Hey guys Quick question: how do i find out if the remainder of 4 divided by 2 is a whole number ? NEED CODE PLEAS THANX IN ADVANCE Nov 20 '05 #1
4 Replies

 P: n/a "=?Utf-8?B?V2lsbA==?=" wrote in news:43**********************************@microsof t.com: Quick question: how do i find out if the remainder of 4 divided by 2 is a whole number ?? It used to be mod in VB, prob still is. -- Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/ "Programming is an art form that fights back" ELKNews - Get your free copy at http://www.atozedsoftware.com Nov 20 '05 #2

 P: n/a "=?Utf-8?B?V2lsbA==?=" wrote in news:43**********************************@microsof t.com: Quick question: how do i find out if the remainder of 4 divided by 2 is a whole number ?? Sorry, Mod would give you the remainder from int division. -- Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/ "Programming is an art form that fights back" ELKNews - Get your free copy at http://www.atozedsoftware.com Nov 20 '05 #3

 P: n/a You can use Mod, because any whole number Mod 1 = 0. For example: Debug.WriteLine( (4 / 2) Mod 1 = 0) ' writes True Debug.WriteLine( (4 / 3) Mod 1 = 0) ' writes False "Will" wrote in message news:43**********************************@microsof t.com... Hey guys, Quick question: how do i find out if the remainder of 4 divided by 2 is a whole number ?? NEED CODE PLEASE THANX IN ADVANCE Nov 20 '05 #4

 P: n/a I assume you mean "how do I tell if the quotient (result) of 4 divided by 2 is a while number?". See code below; the second example is preferable. There are several more ways to do this. Prester John Dim n1 As Decimal = 3 Dim n2 As Decimal = 2 If Int(n1 / n2) = n1 / n2 Then MsgBox("Whole number") Else MsgBox("Not a whole number") End If ----or------ Dim n1 As Decimal = 4 Dim n2 As Decimal = 2 If Decimal.Remainder(n1, n2) = 0 Then MsgBox("Whole number") Else MsgBox("Not a whole number") End If "Will" wrote in message news:43**********************************@microsof t.com... Hey guys, Quick question: how do i find out if the remainder of 4 divided by 2 is a whole number ?? NEED CODE PLEASE THANX IN ADVANCE Nov 20 '05 #5

### This discussion thread is closed

Replies have been disabled for this discussion. 