• Lenguaje

    Visual Basic .Net

  • Descripción

    Hallar el cociente y el residuo (resto) de dos números.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Module CocienteYResiduoDeDosNumeros

    Sub Main()
        Dim a, b, cociente, residuo As Integer
        Console.Write("Ingresa el valor de a: ")
        a = Integer.Parse(Console.ReadLine())
        Console.Write("Ingresa el valor de b: ")
        b = Integer.Parse(Console.ReadLine())
        If b <> 0 Then
            cociente=a/b
            residuo=a Mod b
        Else
            cociente=0
            residuo=0
            Console.WriteLine("Intederminaci" & ChrW(&HF3) & "n")
        End If
        Console.WriteLine("Valor de cociente: " & cociente)
        Console.WriteLine("Valor de residuo: " & residuo)
        Console.WriteLine()
        Shell ("cmd /c pause", AppWinStyle.NormalFocus, True)
    End Sub

End Module