martes, 25 de junio de 2019

Ejercicios Segunda Parte

ÁREA CUADRADO
Module Ejercicio4

    Sub Main()

        Console.WriteLine("Escribe el valor de un radio")
        Dim radio As Double = Console.ReadLine()

        Dim area As Double = Math.PI * Math.Pow(radio, 2)

        Console.WriteLine("El area es " & area)

        Console.ReadLine()

    End Sub

End Module

BUCLE

Module Ejercicio7

    Sub Main()

        For i As Integer = 0 To 100

            If i Mod 2 <> 0 Then
                Console.WriteLine(i)
            End If

        Next

        Console.ReadLine()

    End Sub

End Module


CALCULO DEL IVA

Module Ejercicio2

    Sub Main()

        Const IVA As Double = 0.21

        Console.WriteLine("Escribe el valor de un producto")
        Dim producto As Double = Console.ReadLine

        Console.WriteLine("El IVA del producto es " & producto * IVA & " euros. El valor final es " & producto + (producto * IVA) & " euros")

        Console.ReadLine()

    End Sub

End Module



CREAR NÚMERO ALEATORIO

Module Module1

    Sub Main()

        Dim numeroAleatorio As Integer = numAleatorioEntre(1, 10)

        Console.WriteLine("El numero generado es: " & numeroAleatorio)


        Console.ReadLine()

    End Sub

    Function numAleatorioEntre(ByVal minimo As Integer, ByVal maximo As Integer) As Integer
        Randomize()
        Return CLng((minimo - maximo) * Rnd() + maximo)
    End Function

End Module


GENERA 10 NÚMEROS ALEATORIOS

Module Module1

    Sub Main()

        Dim numeroAleatorio As Integer

        For i = 1 To 10

            numeroAleatorio = numAleatorioEntre(1, 10)

            Console.WriteLine("El numero generado es: " & numeroAleatorio)

        Next



        Console.ReadLine()

    End Sub

    Function numAleatorioEntre(ByVal minimo As Integer, ByVal maximo As Integer) As Integer
        Randomize()
        Return CLng((minimo - maximo) * Rnd() + maximo)
    End Function

End Module



MUESTRA NÚMEROS DEL 0 AL 100

Module Ejercicio6

    Sub Main()

        Dim i As Integer = 0

        While i <= 100

            If i Mod 2 <> 0 Then
                Console.WriteLine(i)
            End If

            i = i + 1

        End While

        Console.ReadLine()

    End Sub

End Module



PIDE 2 NÚMEROS POR TECLADO

Module Ejercicio5

    Sub Main()

        Console.WriteLine("Escribe el valor del primer numero")
        Dim num1 As Integer = Console.ReadLine()

        Console.WriteLine("Escribe el valor del segundo numero")
        Dim num2 As Integer = Console.ReadLine()

        If num1 Mod num2 = 0 Then
            Console.WriteLine("El número " & num1 & " es divisible por " & num2)
        Else
            Console.WriteLine("El número " & num1 & " no es divisible por " & num2)
        End If

        Console.ReadLine()

    End Sub

End Module


PIDE NÚMERO ENTRE 0 Y 10

Module Ejercicio8

    Sub Main()

        Dim num As Integer

        Do
            Console.WriteLine("Escribe un numero entre 0 y 10")
            num = Console.ReadLine

        Loop While num <= 0 Or num >= 10

        Console.WriteLine("El número introducido es " & num)

        Console.ReadLine()

    End Sub

End Module


SALUDO

Module Ejercicio1

    Sub Main()

        Console.WriteLine("Escribe un nombre")
        Dim nombre As String = Console.ReadLine

        Console.WriteLine("¡Hola " & nombre & "!")

        Console.ReadLine()

    End Sub

End Module


TABLA DE MULTIPLICAR

Module Ejercicio3

    Sub Main()

        Console.WriteLine("Escribe un numero")
        Dim numero As Integer = Console.ReadLine

        For i As Integer = 1 To 10

            Console.WriteLine(numero & " x " & i & " = " & numero * i)

        Next

        Console.ReadLine()

    End Sub

End Module



No hay comentarios.:

Publicar un comentario

Ejercicios Link Unidad No.3 Lenguaje Ensamblador

https://mega.nz/#F!30lAhSCB !eJSPm_L1GaETO7qZ1FmiQg *Cambia todas las letras a minúsculas *CBW Y CWD *Definición del Segmento de datos ...