G gh May 22, 2005 #1 I am dividing var1 by var2 and I want to check and see if there is a remainder. How do I do this in C#? TIA
I am dividing var1 by var2 and I want to check and see if there is a remainder. How do I do this in C#? TIA
J Jon Shemitz May 22, 2005 #2 I am dividing var1 by var2 and I want to check and see if there is a remainder. How do I do this in C#? Click to expand... The % operator.
I am dividing var1 by var2 and I want to check and see if there is a remainder. How do I do this in C#? Click to expand... The % operator.
R rossum May 22, 2005 #3 I am dividing var1 by var2 and I want to check and see if there is a remainder. How do I do this in C#? TIA Click to expand... Use the modulus (%) operator: int var1 = 7; int var2 = 4; int quotient, remainder; quotient = var1 / var2; remainder = var1 % var2; HTH rossum The ultimate truth is that there is no ultimate truth
I am dividing var1 by var2 and I want to check and see if there is a remainder. How do I do this in C#? TIA Click to expand... Use the modulus (%) operator: int var1 = 7; int var2 = 4; int quotient, remainder; quotient = var1 / var2; remainder = var1 % var2; HTH rossum The ultimate truth is that there is no ultimate truth
J Jay B. Harlow [MVP - Outlook] May 22, 2005 #4 gh, In addition to the % operator, you can use System.Math.DivRem which does both the division & the remainder in one statement. Hope this helps Jay |I am dividing var1 by var2 and I want to check and see if there is a | remainder. How do I do this in C#? | | TIA
gh, In addition to the % operator, you can use System.Math.DivRem which does both the division & the remainder in one statement. Hope this helps Jay |I am dividing var1 by var2 and I want to check and see if there is a | remainder. How do I do this in C#? | | TIA