Beruflich Dokumente
Kultur Dokumente
Sub Main()
Dim x, i, a As Integer
Dim z As Char
Do
PRIMO")
Console.Clear()
Console.WriteLine(" PROGRAMA DEL NUMERO ES PRIMO O NO ES
Console.WriteLine()
Console.WriteLine()
Console.WriteLine(" INGRESAR UN NUMERO ")
x = Console.ReadLine
If x = 1 Then
Console.WriteLine(" el numero es primo:" & x)
Else
a = 0
For i = 1 To x
If x Mod i = 0 Then
a = a + 1
End If
Next
If a = 2 Then
Console.WriteLine(" el numero es primo")
Else
Console.WriteLine(" el numero no es primo")
End If
End If
Console.WriteLine()
Console.WriteLine()
Console.WriteLine(" <<<
z = Console.ReadLine
Console.Clear()
Console.WriteLine(" PROGRAMA DE LOS MULTIPLOS DE 5
COMPRENDIDOS ENTRE A y B")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine(" INGRESAR UN NUMERO ")
Console.WriteLine()
n = Console.ReadLine
suma = 0
X = 1
A = 1
B = 50
For i = 1 To n
If i Mod 5 = 0 Then
Console.WriteLine()
Console.WriteLine(" escribir " & i)
suma = suma + X
End If
X = X + 1
Next
Console.WriteLine()
Console.WriteLine()
Console.WriteLine(" la suma de los multiplos es: " & suma)
Console.WriteLine()
Console.WriteLine(" PARA TERMINAR DIGITE << N >> ")
res = Console.ReadLine
Loop Until (res = "n" Or res = "N")
End Sub
End Module
Leer 100 nmeros. Determinar la media de los nmeros negativos y de los positivos,
realizar con lazo mientras y lazo fijo
Con lazo fijo
Module Module1
Sub Main()
Dim pos, neg, spos, sneg, x, propos, proneg As Double
Module Module1
Sub Main()
Dim pos, neg, spos, sneg As Integer
Dim mpos, mneg, num, i As Integer
Dim r As Char
Do
Console.Clear()
Console.WriteLine()
Console.WriteLine(" PROGRAMA DE LA MEDIA DE LOS POSITIVO Y
NEGATIVO ")
Console.WriteLine()
Console.WriteLine()
While (i <= 100)
Console.WriteLine()
Console.WriteLine(" ingresar un numero")
num = Console.ReadLine
If num < 0 Then
sneg = sneg + num
neg = neg + 1
Else
spos = spos + num
pos = pos + 1
End If
i = i + 1
Mneg)
Mpos)
End While
Mneg = sneg / neg
Mpos = spos / pos
Console.WriteLine()
Console.WriteLine("
LA MEDIA DE LOS
Console.WriteLine("
LA MEDIA DE LOS
Console.WriteLine()
Console.WriteLine(" digite << N >> para finalizar ")
r = Console.ReadLine
Console.WriteLine()
Next
Console.WriteLine(" <<< digite una tecla para finalizar >>>")
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
Dim bin, c, x, i As Long
Dim res As Char
Do
Console.Clear()
Console.WriteLine(" PROGRAMA DEL NUMERO BINARIO")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine(" INGRESAR UN NUMERO")
x = Console.ReadLine
If x > 0 Then
c = x
i = 1
bin = 0
While c
bin
c =
i =
<> 1
= bin + (c Mod 2) * i
Math.Truncate(c / 2)
i * 10
End While