I'm sure some of you know the equation to get the distance of 2 points on a coordinate grid, and I'm making a program to do just that, the only problem is that when I use the square root function it doesn't return an exact number, what's wrong with my code?
vb Code:
  1. Dim P1 As Integer = CInt(X2.Text) - CInt(X1.Text)
  2.         Dim P2 As Integer = CInt(Y2.Text) - CInt(Y1.Text)
  3.         Dim XX1 As Integer = P1 * P1
  4.         Dim YY1 As Integer = P2 * P2
  5.         Dim W1 As Integer = XX1 + YY1
  6.         Dim Sq As Integer = System.Math.Sqrt(W1)
  7.         Sol.Text = Sq

I don't get why it automatically rounds the number up. Can anyone tell me how to code it to get an exact square root?