Está en la página 1de 38

TALLER 05 ESTRUCTURAS

CÓDIGO 6000992 APELLIDO Y


NOM

 ESTRUCTURA SELECTIVA
Cuando se necesita tomar una decisión, se debe usar la estructura selectiva.
(incluir Pseudocódigo con explicación de las comparaciones , diagrama de bloques, cambiar nombre
variables, autor, datos de prueba .)

1.-Leer una nota y determinar si es aprobatoria o reprobatoria,

PSEUDOCODIGO

INICIO

Definir variable NOTA

Escribir “Digite una nota entre 00 y 50”

Leer NOTA

sí (NOTA > 30)

entonces escribir “APROBADA”

sino

entonces escribir “REPROBADA”

fin_si

Escribir “AUTOR: EMILY VALENTINA SANCHEZ PEDRAZA”

FIN

PRUEBA DE ESCRITORIO

NOTA MENSAJE
45 APROBADA
20 REPROBADA

DIAGRAMA DE BLOQUES
2.- Leer una nota y validar si es correcta (Entre 0.0 y 5.0)
PSEUDOCODIGO

INICIO

Definir variable N

Escribir “Digite una nota entre 0.0 y 5.0”

Leer N

sí (N > 0.0) o (N < 5.0)

entonces escribir “LA NOTA ES VALIDA”

sino

entonces escribir “LA NOTA NO ES VALIDA”

fin_si

Escribir “AUTOR: EMILY VALENTINA SANCHEZ PEDRAZA”

FIN

PRUEBA DE ESCRITORIO

N MENSAJE
3.5 LA NOTA ES VALIDA
100 LA NOTA NO ES VALIDA

DIAGRAMA DE BLOQUES
3.- Leer una nota, validar si es correcta y determinar si es aprobatoria o reprobatoria

PSEUDOCODIGO

INICIO

Definir variable CALIFICACION

Escribir “Digite una calificación entre 0.0 y 5.0”

Leer CALIFICACION

sí (CALIFICACION > 3.0)

si (CALIFICACION > 0.0) o (CALIFICACION < 5.0)

Escribir “LA CALIFICACIÓN ES VALIDA”

sino

Escribir “LA CALIFICACIÓN NO ES VALIDA”

fin_si

Escribir “APROBADA”

sino

Escribir “REPROBADA”

fin_si

Escribir “AUTOR: EMILY VALENTINA SANCHEZ PEDRAZA”

FIN

PRUEBA DE ESCRITORIO

CALIFICACION MENSAJE 1 MENSAJE 2


2.5 LA CALIFICACIÓN ES VALIDA REPROBADA
100 LA CALIFICACIÓN NO ES
VALIDA
4.5 LA CALIFICACIÓN ES VALIDA APROBADA
DIAGRAMA DE BLOQUES
4.-Leer cinco números y calcular el promedio, usar ciclo Para o for

PSEUDOCODIGO

INICIO

Definir variables NUM, SUMA NUM, PROMEDIO

Suma 0

Para i 1, 5, 1

Leer “DIGITE UN NUMERO”

SUMA NUM NUM + SUMA NUM

fin_para

PROMEDIO SUMA NUM / 5

Escribir “PROMEDIO”

Escribir “AUTOR: EMILY VALENTINA SANCHEZ PEDRAZA”

FINAL

PRUEBA DE ESCRITORIO

NUM 1 NUM 2 NUM 3 NUM 4 NUM 5 PROMEDIO


10 50 25 80 35 40
9 5 7 12 23 11,2

DIAGRAMA DE BLOQUES
5.-Leer N números y determinar cuántos son pares y cuántos son impares, usar ciclo
Para o for

PSEUDOCODIGO

INICIO

Definir variables C, N, P, I, CON

Leer “CANTIDAD DE NUMEROS”

Para i 1, C

CON = CON + 1

Leer “NUMERO”

si (N MOD 2 = 0)

entonces P = P + 1

sino

I=I+1

fin_si

fin_para

Leer “HAY” P “NUMERO PARES Y” I “IMPARES”

Leer “AUTOR: EMILY VALENTINA SANCHEZ PEDRAZA”

FINAL

PRUEBA DE ESCRITORIO

C N P I
4 5, 8, 23, 66 “HAY 2 NUMEROS PARES” “Y 2 NUMEROS IMPARES”
3 234, 155, 996 “HAY 2 NUMEROS PARES” “Y 1 NUMERO IMPAR”
6.- Hacer el algoritmo de dos (2) formas diferentes
Leer un carácter, determinar si es una letra, un número, otro carácter..
Cambiar el orden de las preguntas y respuestas; siempre los resultados
finales son los mismos usando valores iguales. Consultar Unidad 04
estructuras.pdf

PSEUDOCÓDIGO

INICIO

Leer CAR

si (CAR > o = 'a' y CAR < o = 'z')

entonces Escribir “ES LETRA”

sino

si (CAR >= '0' Y CAR <= '9')

entonces Escribir “ES NUMERO”

sino

Escribir “ES OTRO CARACTER”

fin_si

fin_si

Fin
PRUEBA DE ESCRITORIO

CAR MENSAJE 1 MENSAJE 2 MENSAJE 3


4 ES NUMERO
a ES LETRA
, ES OTRO CARACTER
PSEUDOCODIGO

INICIO

Definir variable CAR

Leer CAR

si (CARACTER = o > 'a' y CARACTER = o < 'z')

entonces Escribir “ES LETRA”

sino

si (CAR >= '0' Y CAR <= '10')

entonces Escribir “ES NUMERO”

sino

Escribir “ES OTRO CARACTER”

fin_si

fin_si

Fin

PRUEBA DE ESCRITORIO

CAR MENSAJE 1 MENSAJE 2 MENSAJE 3


7 ES NUMERO
h ES LETRA
: ES OTRO CARACTER
7.- Hacer el algoritmo de dos (2) formas diferentes
Leer tres números, determinar cuál es el mayor...
Cambiar el orden de las preguntas y respuestas; siempre los resultados finales son
los mismos usando valores iguales.

INICIO

Definir variables NUM1, NUM2, NUM3

Leer NUM1, NUM2, NUM3

si (NUM1 >= NUM2 Y NUM1 > NUM3)

entonces Escribir NUM1

sino

si (NUM2 >= NUM1 Y NUM2 > NUM3)

entonces Escribir NUM2

sino

Escribir NUM3

fin_si

fin_si

FIN

PRUEBA DE ESCRITORIO

NUM1 NUM2 NUM3 MENSAJE


45 30 55 EL NUMERO MAYOR ES
EL 55
30 2 3 EL NUMERO MAYOR ES
30

También podría gustarte