I want to perform integer division in VB.NET, i.e. only keep the whole part of division result.
Dim a, b, c as int32
a = 3500
b = 1200
c = a/b
This example outputs 3.
How do I make it return 2 instead?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actual calculation:
3500/1200 = 2.916You have to use
Math.Floormethod to roundup the value to2as below –More information is available on MSDN – Math.Floor