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([Link]) For i = 1 To a If (a Mod i) = 0 Then [Link] (i) End If Next i
Nmeros impares
If Cint([Link]) Mod 2 = 0 Then [Link]="Es par" Else [Link]="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([Link]) While (cont <= [Link]) 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([Link]) And IsNumeric([Link]) Then [Link] = "" c=0 a = Val([Link]) b = Val([Link]) If a > b Then c=a a=b b=c End If For c = a To b If c Mod 5 = 0 Then [Link] = [Link] + [Link](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 . . . . . .