How to remove the second digit from a number in VB.NET

1 Answer

0 votes
Imports System

Public Class Program
    Public Shared Function remove_second_digit(ByVal n As Integer) As Integer
        Dim str As String = Convert.ToString(n)
		
        str = str.Substring(0, 1) & str.Substring(2)
        
		Return Integer.Parse(str)
    End Function

    Public Shared Sub Main(ByVal args As String())
        Dim n As Integer = 87315
		
        n = remove_second_digit(n)
		
        Console.WriteLine(n)
    End Sub
End Class



' run:
'
' 8315
'

 



answered Jan 13, 2024 by avibootz

Related questions

...