Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim dblA, dblB, dblC, dblD, dblE As Double
'''First we convert the dblA to integer
Double.TryParse(txtInput.Text, dblA)
''' The next step is meant to make sure that we are atleast in or over the required range
If Math.Abs(dblA) >= 1000 Then
dblA = dblA Mod 100000
''' The mod function deals with the remainder which ultimately helps us to remove any digits after the 10000th position
dblA = dblA 100
''' and now after doing this step, we are taking the quotient which takes the digits after the 100th position away
If dblA Mod 11 = 0 Then
''' again making sure remainder is zero so that we know that it is divisible by 11
txtAnswer.Text = "Value is divisible by 11"
''' i did the steps including dblB to dblE to have a better command over mod function and divide function
txtFinal.Text = dblA
dblB = dblA 100
txt10000.Text = dblB
dblC = dblA Mod 100
dblD = dblC 10
txt1000.Text = dblD
dblE = dblA Mod 10
txt100.Text = dblE
Else
txtAnswer.Text = "Value is not Divisible by 11"
txtFinal.Text = dblA
dblB = dblA 100
txt10000.Text = dblB
dblC = dblA Mod 100
dblD = dblC 10
txt1000.Text = dblD
dblE = dblA Mod 10
txt100.Text = dblE
End If
Else
txtAnswer.Text = "Invalid Entry"
txt100.Text = "N/A"
txt1000.Text = "N/A"
txt10000.Text = "N/A"
txtFinal.Text = "N/A"
End If
''' the more use of mod and divide function also helped to make the program more thorough
End Sub
it turns out with negative sign
New contributor
Prince Gulati is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2