La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Trabajo Práctico 2 Agustin Arias 1ºB. Ejercicio 1 Ingresar un número cualquiera e informar si es positivo, negativo o nulo.

Presentaciones similares


Presentación del tema: "Trabajo Práctico 2 Agustin Arias 1ºB. Ejercicio 1 Ingresar un número cualquiera e informar si es positivo, negativo o nulo."— Transcripción de la presentación:

1 Trabajo Práctico 2 Agustin Arias 1ºB

2 Ejercicio 1 Ingresar un número cualquiera e informar si es positivo, negativo o nulo.

3 C F Número Negativo Nulo Positivo Número = 0 Número > 0 V = Verdadero F = Falso V V F

4 Pantalla 1

5 Private Sub CommandButton1_Click() Dim Número As Integer Número = Val(TextBox1) If Número = 0 Then Label3 = ("El Número es Nulo") Else If Número > 0 Then Label3 = ("El Número es Positivo") Else Label3 = ("El Número es Negativo") End If End Sub Programación 1

6 Ejercicio 2 Ingresar 4 número cualesquiera. Informar el total si todos son positivos. Si no, informar "ingrese números positivos solamente”.

7 V = Verdadero F = Falso C Número1 Número2 Número Número3 Número4 F Solo Nº Positivos Nº1 > 0, Nº2 > 0, Nº3 > 0 y Nº4 > 0 V F Nº1+Nº2+Nº3+Nº4 … …

8 Pantalla 2

9 Private Sub CommandButton1_Click() Dim Nº1, Nº2, Nº3, Nº4 As Integer Nº1 = Val(TextBox1) Nº2 = Val(TextBox2) Nº3 = Val(TextBox3) Nº4 = Val(TextBox4) If Nº1 + Nº2 + Nº3 + Nº4 = 0 Then Label3 = ("El Número es Nulo") Else If Nº1 + Nº2 + Nº3 + Nº4 > 0 Then Label3 = ("El Número es Positivo") Else Label3 = ("El Número es Negativo") End If End Sub Programación 2

10 Ejercicio 3 Ingresar dos números cualesquiera. Informar "ambos positivos", "ambos negativos", "primero positivo y segundo no" o "segundo positivo y primero no“.

11 V = Verdadero F = Falso C Número1 Número2 Nº1 > 0 y Nº2 < 0 … Nº1 > 0 y Nº2 > 0 Nº1 < 0 y Nº2 < 0 Número = 0 … F Positivos 1º Positivo V V Negativos 1º Negativo V F … … …

12 Pantalla 3

13 Private Sub CommandButton1_Click() Dim Nº1, Nº2 As Integer Nº1 = Val(TextBox1) Nº2 = Val(TextBox2) If Nº1 > 0 And Nº2 > 0 Then Label3 = ("Ambos son Positivos") Else If Nº1 < 0 And Nº2 < 0 Then Label3 = ("Ambos son Negativos") Else If Nº1 0 Then Label3 = ("El 1º es Negativo y el 2º es Positivo") Else If Nº1 > 0 And Nº2 < 0 Then Label3 = ("El 1º es Positivo y el 2º es Negativo") Else If Nº1 = 0 And Nº2 = O Then Label3 = ("Ambos son Nulo") Else Programación 3 If Nº1 = 0 And Nº2 > O Then Label3 = ("El 1º es Nulo y el 2º es Positivo") Else If Nº1 = 0 And Nº2 < 0 Then Label3 = ("El 1º es Nulo y el 2º es Negativo") Else If Nº1 > 0 And Nº2 = 0 Then Label3 = ("El 1º es Positivo y el 2º es Nulo") Else If Nº1 < 0 And Nº2 = 0 Then Label3 = ("El 1º es Negativo y el 2º es Nulo") End If End Sub

14 Ejercicio 4 Ingresar dos números enteros cualesquiera. Informar "el primero es mayor que el segundo", "el segundo es mayor que el primero" o "son iguales" según corresponda.

15 V = Verdadero F = Falso C Número1 Número2 Nº1 > Nº2 1º es Mayor V F Iguales Nº1 < Nº2 V F 1º es Menor

16 Pantalla 4

17 Private Sub CommandButton1_Click() Dim Nº1, Nº2 As Integer Nº1 = Val(TextBox1) Nº2 = Val(TextBox2) If Nº1 > Nº2 Then Label3 = ("El 1º es Mayor que el 2º") Else If Nº1 < Nº2 Then Label3 = ("El 1º es Menor que el 2º") Else If Nº1 = Nº2 Then Label3 = ("Ambos son Iguales") End If End Sub Programación 4

18 Ejercicio 5 Ingresar cuatro números cualesquiera, si su suma es mayor a 15 elevarlo al cuadrado, si no, elevarlo al cubo.

19 V = Verdadero F = Falso C Número1 Número2 Número Número3 Número4 … … F Nº1+Nº2+Nº3+Nº4 > 15 Número > 0 V F Nº1+Nº2+Nº3+Nº4 * 3 Nº1+Nº2+Nº3+Nº4 * 2

20 Pantalla 5

21 Private Sub CommandButton1_Click() Dim Nº1, Nº2, Nº3, Nº4 As Integer Nº1 = Val(TextBox1) Nº2 = Val(TextBox2) Nº3 = Val(TextBox3) Nº4 = Val(TextBox4) If Nº1 + Nº2 + Nº3 + Nº4 > 15 Then Label3 = (Nº1 + Nº2 + Nº3 + Nº4) * 2 Else If Nº1 + Nº2 + Nº3 + Nº4 = 15 Then Label3 = (Nº1 + Nº2 + Nº3 + Nº4) * 3 Else If Nº1 + Nº2 + Nº3 + Nº4 < 15 Then Label3 = (Nº1 + Nº2 + Nº3 + Nº4) * 3 End If End Sub Programación 5

22 Ejercicio 6 Ingresar un número cualquiera e informar si es par o impar.

23 V = Verdadero F = Falso C Número F Impar Par Finaliza en 0, 2, 4, 6, 8 Número > 0 V F

24 Pantalla 6

25 Private Sub CommandButton1_Click() Dim Número As Integer Número = Val(TextBox1) If Número Mod 2 = 0 Then Label3 = ("Es Par") Else Label3 = ("Es Impar") End If End Sub Programación 6

26 Ejercicio 7 Ingresar dos números, sumarlos e informar si la suma da por resultado un número par o impar.

27 V = Verdadero F = Falso C Número1 Número2 F Resultado Impar Resultado Par Nº1 + Nº2 MOD 2 = 0 Número > 0 V F

28 Pantalla 7

29 Private Sub CommandButton1_Click() Dim Nº1, Nº2 As Integer Nº1 = Val(TextBox1) Nº2 = Val(TextBox2) If (Nº1 + Nº2) Mod 2 = 0 Then Label3 = "El Resultado es Par" Else If (Nº1 + Nº2) Mod 2 <> 0 Then Label3 = "El Resultado es Impar" End If End Sub Programación 7

30 Ejercicio 8 Ingresar un número cualquiera e informar si es positivo y par, positivo impar, negativo par o negativo impar.

31 V = Verdadero F = Falso C Número Negativo Positivo Nº > 0 V F F Impar Par Nº1 + Nº2 MOD 2 = 0 V F

32 Pantalla 8

33 Private Sub CommandButton1_Click() Dim Nº1 As Double Nº1 = Val(TextBox1) If Nº1 > 0 And Nº1 Mod 2 = 0 Then Label3 = ("El Número es Positivo y Par") Else If Nº1 > 0 And Nº1 Mod 2 <> 0 Then Label3 = ("El Número es Positivo e Impar") Else If Nº1 < 0 And Nº1 Mod 2 = 0 Then Label3 = ("El Número es Negativo y Par") Else Label3 = ("El Número es Negativo e Impar") End If End Sub Programación 8


Descargar ppt "Trabajo Práctico 2 Agustin Arias 1ºB. Ejercicio 1 Ingresar un número cualquiera e informar si es positivo, negativo o nulo."

Presentaciones similares


Anuncios Google