Utilizando el Operador MOD
Hallando la Suma de un Numero de 2 Dígitos en Visual Basic 2010
Sub Main()
Dim n As Integer
Dim uni, dec As Integer
Dim s As Integer
Console.Write("Ingrese Numero:")
n = Console.ReadLine
dec = n \ 10
uni = n Mod 10
s = uni + dec
Console.WriteLine("La Suma de sus digitos es:{0}", s)
Console.ReadLine()
End Sub
Sub Main()
Dim n As Integer
Dim uni, dec As Integer
Dim s As Integer
Console.Write("Ingrese Numero:")
n = Console.ReadLine
dec = n \ 10
uni = n Mod 10
s = uni + dec
Console.WriteLine("La Suma de sus digitos es:{0}", s)
Console.ReadLine()
End Sub
Comentarios