title: Reducing Fractions
body: <p>My code:</p>
  
  <pre><code>Private Sub btnReduce_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReduce.Click
  
      Call Reduce()
  
  End Sub
  
  Function Reduce() As Single
  
      Dim num As Integer = txtNum.Text
      Dim deno As Integer = txtDeno.Text
  
      For i = 1 To deno Step +1
          If num Mod i = 0 Then
              num = num / i
          End If
  
          If deno Mod i = 0 Then
              deno = deno / i
          End If
  
      Next
  
      lblOutputNum.Text = num
      lblOutputDeno.Text = deno
  
  End Function
  </code></pre>
  
  <p>When I enter 2/4 it gives me 1/2. But when I enter 3/6 it gives me 1/1. Does anyone know why it does this? As I can't figure this out. Thanks to anyone who can.</p>