Está en la página 1de 2

Todos los nmeros son divisibles por uno.

for n=2 to (Nmero/2+1) if (numero mod n)=0 then msgbox "No es primo" exit sub end if next msgbox "Es primo" Divisores de un numero ingresado

Dim i Dim a a = Val(Text1.Text) For i = 1 To a If (a Mod i) = 0 Then List1.AddItem (i) End If Next i
Nmeros impares

If Cint(text1.text) Mod 2 = 0 Then Label1.caption="Es par" Else Label1.caption="Es impar" End If :-.-.-._..._:-.-:_.-.. Private Sub Command1_Click() Dim i As Integer For i = 0 To 100 Step 2 Print i Next End Sub -.-.-.-..--.-.
Option Explicit Dim cont As Integer Private Sub Command1_Click() cont = Val(Text1.Text) While (cont <= Text2.Text) If (cont Mod 2 <> 0) Then MsgBox (cont) End If cont = cont + 1 Wend End Sub ..-..-.-.-.-.-.-.-.-.-.Dim numero As Integer numero = InputBox("ingrese un numero") If numero > 0 Then MsgBox("el numero es positivo")

ElseIf numero < 0 Then MsgBox("el numero es negativo") ElseIf numero = 0 Then MsgBox("el numero no tiene signo") End If

6.- Generalice su aplicacin para que el usuario ingrese dos nmeros y que la aplicacin evale si el primer nmero ingresado el mltiplo del segundo nmero ingresado. Dim a As Integer Dim b As Integer Dim c As Integer If IsNumeric(txta.Text) And IsNumeric(txtb.Text) Then txtmultiplos.Text = "" c=0 a = Val(txta.Text) b = Val(txtb.Text) If a > b Then c=a a=b b=c End If For c = a To b If c Mod 5 = 0 Then txtmultiplos.Text = txtmultiplos.Text + Convert.ToString(c) + vbNewLine End If Next Else MsgBox("Error") End If 1. Realice una aplicacin que evale una nota ingresada por el usuario, especificacin: 5> nota >= 0 10 > nota>=5 13 > nota>=10 17 > nota>=13 20 > nota>=17 : Psimo : Malo : Regular : Bueno : Excelente segn la

2. Explique la diferencia encuentra en las siguientes estructuras: a) If x > 0 then b) If x>=0 Then i=i+1 i=i+1 Else End If i=i-1 End If . . . . . .

También podría gustarte