Pseudocodigo y Diagramas de Flujo

Reproductor

CAFETERIA CBTIS 172

MENU

1) DESAYUNO
2) ALMUERZO
3) COMIDA
4) SALIR

1.[CAFETERÍA CBTIS 172]
2.[DECLARAR VARIABLES]
Opc: chart
No. Control: string
3.[IMPRIMIR FECHA]
Write (‘fecha´, date)
4.[IMPRIMIR MENÚ DE OPCIÓN]
Write (‘’)
Write (‘menu’)
Write (‘’)
Write (1) (desayuno)
Write (2) (almuerzo)
Write (3) (comida)
Write (4) salir)
Write (´’)
Write (‘No control’)
Read (No Control)
Write (‘opcion’)
Read (opcion)
5.[IMPRIMIR OPCIÓN]
Write (opc)
6.[FIN DEL PSEUDOCÓDIGO]
@

AREA FIGURAS GEOMETRICAS

1. [ÁREA FIGURAS GEOMÉTRICAS]
2. [DECLARA VARIABLES]
Base, altura, lado, d mayor, d menor, área t, área c, área r: real
3. [CALCULAR EL ÁREA DEL TRIANGULO]
Write (‘Area del triangulo’)
Write (‘’)
4. [PEDIR DATOS DEL TRIANGULO]
Write (‘la base del triangulo es:’)
Read (base)
Write (‘la altura del triangulo es:’)
Read (altura)
5. [CALCULAR ÁREA]
Área T (base*altura)/2
6. [IMPRIMIR DATOS]
Write (‘el área del triangulo es:’, área t)
7. [CALCULAR EL ÁREA DEL CUADRADO]
8. [CALCULAR]
Write (‘área del cuadrado’)
Write (‘’)
9. [PEDIR DATOS DEL CUADRADO]
Write (‘el lado del cuadrado es:’)
Read (lado)
10. [CALCULAR EL ÁREA]
Área lado*lado
11. [IMPRIMIR DATOS]
Write (‘él área del cuadrado es:’, área c)
12. [CALCULAR ÁREA DEL ROMBO]
Write (‘área del rombo’)
Write (‘’)
13. [PEDIR DATOS DEL ROMBO]
Write (‘La diagonal mayor del rombo es:’)
Read (d mayor)
Write (‘la diagonal menor del rombo es:’)
Read (d menor)
14. [CALCULAR ÁREA]
Área R (d mayor*d menor)/2
15. [IMPRIMIR DATOS]
Write (‘el área del rombo es:’, área r)
16. [FIN DEL PSEUDOCÓDIGO]
@

TIENDITA DE LA ESQUINA

1. [TIENDITA DE LA ESQUINA]
2. [DECLARAR VARIABLES]
articulo1, articulo2, articulo3: string
cant1, cant2, cant3: interger
precio1, precio2, precio3, imp1, imp2, imp3, total, efectivo, cambio: real
3. [PEDIR DATOS ARTICULO 1]
Write (‘articulo1’)
Read (articulo1)
Write (‘cantidad articulo 1’)
Read (cant1)
Write (‘precio’)
Read (precio1)
4. [CALCULAR IMPORTE]
Imp1 cant1*precio1
5[PEDIR DATOS ARTÍCULO 2]
Write (‘articulo2’)
Read (articulo2)
Write(‘cantidad del articulo 2’)
Read (cant2)
Write (‘précio’)
Read (precio2)
6. [CALCULAR IMPORTE]
imp. cant2*precio2
7. [PEDIR DATOS DEL ARTICULO 3]
Write (‘articulo 3’)
Read (articulo3)
Write (‘cantidad articulo 3’)
Read (cant3)
Write (‘precio 3’)
Read (precio3)
8. [CALCULAR IMPORTE]
Imp3 cant3*precio3
9. [CALCULAR TOTAL]
Total imp1+imp2+imp3
10. [MONTO PAGADO]
Write (‘efectivo’)
Read (efec)
11. [CALCULAR CAMBIO]
Cambio total-efec
12. [IMPRIMIR LISTA DE PRODUCTOS]
Write (‘la tiendita’)
Write (‘’)
Write (‘articulo’)
Write (articulo1)
Write (‘articulo’)
Write (articulo2)
Write (‘articulo’)
Write (articulo3)
Write (‘cantidad’)
Write (cant1)
Write (‘cantidad’)
Write (cant2)
Write (‘cantidad’)
Write (cant3)
Write (‘precio’)
Write (precio1)
Write (‘precio’)
Write (precio2)
Write (‘precio’)
Write (precio3)
Write (‘importe’)
Write (imp1)
Write (‘importe’)
Write (imp2)
Write (‘importe’)
Write (imp3)
Write (‘total’)
Write (total)
Write (‘efectivo’)
Write (efec)
Write (‘cambio’)
Write (cambio)
13. [IMPRIMIR DATOS]
Write (‘el importe del producto1 es de:’)
Write (imp1)
Write (‘el importe del producto 2 es de:’)
Write (imp2)
Write (‘el importe del producto 3 es de:’)
Write (imp3)
Write (‘total’)
Write (total)
Write (‘efectivo’)
Write (efec)
Write (‘total’)
Write (total)
Write (‘cambio’)
Write (cambio)
14. [FIN DEL PSEUDOCÓDIGO]
@

FORMULA

1. [FORMULA]
2. [DECLARA VARIABLES]
Total: real
3. [CALCULAR EL TOTAL]
Total 1+ 1/2 + 1/3 + 1/4
4. [IMPRIMIR LISTA DE DATOS]
Write (‘formula’)
Write (‘’)
Write (‘1’)
Write (’1/2’)
Write (‘1/3’)
Write (‘1/4’)
Write (‘total’)
Write (total)
5. [FIN DEL PSEUDOCÓDIGO]
@

FACTORIAL

1. [FACTORIAL DE UN NUMERO]
2. [DECLARAR VARIABLES]
3. [PEDIR N]
Write (‘n’)
Write (5)
4. [CALCULAR FACTORIAL]
Factorial 5*(5-1)*(5-2)*(5-3)*(5-4)
5. [IMPRIMIR LISTA DE DATOS]
Write (‘factorial’)
Write (‘’)
Write (‘n’)
Write (5)
Write (‘factorial :’)
Write (factorial)
6. [FIN DEL PSEUDOCÓDIGO]
@

NUMERO AL EXPONENTE 4

1. [BASE4]
2. [DECLARAR VARIABLES]
Resultado: entero
N: entero
3. [CALCULAR RESULTADO]
N 4
Resultado n*n*n*n
4. [IMPRIMIR DATOS]
Write (‘resultado’)
Write (resultado)
5. [FIN DEL PSEUDOCÓDIGO]
@

GASOLINERA

1. [GASOLINERA]
2. [DECLARAR VARIABLES]
Gran total: real
LG: real
LD: real
Total: real
Total: real
Iva G: real
Iva D: real
3. [PEDIR DATOS DE LA GASOLINA]
Write (‘litros de gasolina’)
Read (LG)
4. [CALCULAR IVA GASOLINA]
Iva G [(7.8/100)*16]*lg
5. [CALCULAR IMPORTE DE LA GASOLINA]
Total G (lg*7.8) + iva d
6. [PEDIR DATOS DEL DIESEL]
Write (‘litros de diesel’)
Read (LD)
7. [CALCULAR IVA DIESEL]
Iva D [(6.25/100)*16]*ld
8. [CALCULAR IMPORTE DIESEL]
Total D (ld*6.25)+iva d
9. [CALCULAR GRAN TOTAL]
Gran total Iva D + total + iva G + total
10. [IMPRIMIR TICKET]
Write (‘ticket’)
Write (‘litros de gasolina’)
Write (LG)
Write (‘litros de diesel’)
Write (LD)
Write (‘via gasoline’)
Write (Iva G)
Write (‘iva diesel’)
Write (iva D)
Write (‘total’)
Write (total)
Write (Total final)
11. [FIN DEL PSEUDOCÓDIGO]
@

BOLETA CALIFICACIONES

1. [BOLETA DE CALIFICACIONES]
2. [DECLARAR VARIABLES]
Materia: string
Facultad, Alumno, área, asigclave 1, asigclave 2, asigclave 3, asig 1,
asig2, asig3: string
Cal1, cal2, cal3, promedio: real
3. [ELABORAR BOLETA]
Write(‘centro de bachillerato industrial y de servicios 172’)
Write(‘boleta de calificaciones’)
4. [PEDIR DATOS]
Write (‘matriculo, facultad, alumno’)
Read(matricula, facultad, alumno)
Write (‘asignatura clave’)
Read (asigclave1, asigclave2, asigclave3)
Write (‘asignatura’)
Read (asig1, asig2, asig3)
Write (‘calificación’)
Read (cal1, cal2, cal3)
5. [CALCULAR PROMEDIO]
Promedio (cal1+cal2+cal3)/3
6. [IMPRIMIR DATOS]
Write(‘promedio: promedio)
7. [FIN DEL PSEUDOCÓDIGO]
@

NUMERO MAYOR

1. [INICIO MAYOR]
2. [DECLARAR VARIABLES]
N1,N2: interger
3. [LEER DATOS]
Write (‘n1 :’)
Read (n1)
Write (‘n2 :’)
Read (n2)
4. [COMPARAR VALORES]
IF n1>n2
Then
Write(‘el mayor es:’n1)
Else
Write(‘el mayor es:’n2)
5. [FIN DEL PSEUDOCÓDIGO]
@

PEPSICO

1. [PEPSICO]
2. [DECLARAR VARIABLES]
N trabajador: string
D trabajados: interger
Grupo: interger
S base: real
S total, stotal2: real
3. [PEDIR DATOS DEL TRABAJADOR]
Write(‘nombre del trabajador’)
Read(N trabajador)
Write(‘días trabajados’)
Rea(D trabajados)
Write(‘grupo’)
Read(grupo)
Write(‘salario base’)
S base (d trabajados*56.5)+56.5
IF grupo==1
Then
S total S base*0.10
Else
S total S base*0.15
Write(‘sueldo total: ‘total)
4. [FIN DEL PSEUDOCÓDIGO]
@

3 NUMEROS ENTEROS POSITIVOS

1. [INICIO]
2. [DECLARA VARIABLES]
N1,n2,n3,:real
3. [PEDIR NUMERO]
Read (n1)
IF n1>0
Then
Write (‘numero 2’)
Read (n2)
IF n2>0
Then
Write (‘numero 3’)
Read (n3)
IF n3>0
Then
IF n1>n2
Then
IF n1>n3
Then
IF n2>n3
Then
Write(‘el mayor es:’n1)
Write(‘el menor es’:n3)
Else
Write(’el mayor es,’n1)
Write(‘el menor es’,n2)
Else
Write(‘el mayor es ‘,n3)
Write(‘el menor es’,n2)
Else
IF n2>n3
Then
IF n3>n1
Then
Write(‘el mayor es’,n2)
Write(‘el menor es’,n1)
else
Write(‘el mayor es’,n2)
Write(‘el menor es’,n3)

Else
Write(‘el mayor es’,n3)
Write(‘el menor es’,n1)
Else
Write (‘error’)
Else
Write (‘error’)
4. [FIN DEL PSEUDOCÓDIGO]
@

CARTELERA

1. [CARTELERA]
2. [DECLARAR VARIABLES]
Opción: string [2]
Precio: real
3. [IMPRESIÓN DE DATOS]
Write(‘cartelera’)
Write(‘’)
Write(‘1 furia de titanes’)
Write (‘2 Alicia en el país de las maravillas’)
Write (‘3 legión de ángeles’)
Write(‘4 salir)
4. [ELEGIR OPCIÓN]
Read(opción)
5. [CASO]
Case
Opción:’1’
Write(‘precio’)
Read(precio)
Opción:’2’
Write(‘precio’)
Read(precio)
Opción:’3’
Write(‘precio’)
Read(precio)
Opción:’4’
Write(‘Fin’)
6. [FIN PSEUDOCÓDIGO]
@

FIGURAS GEOMETRICAS

1. [FIGURAS GEOMÉTRICAS]
2. [DECLARACIÓN DE VARIABLES]
Base, altura lado, d mayor, d menor, área T, área C, área R: real
3. [IMPRESIÓN DE DATOS]
Write (‘areas’)
Write (‘’)
Write (‘1 area del triangulo’)
Write (‘2 área del cuadrado’)
Write (‘3 área del rombo’)
Write(‘4 salir’)
4. [ELEGIR OPCIÓN]
Read(opción)
5. [CASO]
Case
Opción:’1’
Write (‘datos’)
Read (base)
Read (altura)
Area T (base*altura)/2
Write (Área T)
Opción:’2’
Write (‘datos’)
Read (‘lado’)
Area C lado*lado
Write (Área C)
Opcion: ’3’
Write (‘datos’)
Read (d mayor)
Read (d menor)
Área R (d mayor*d menor)2
Write (area R)
Opcion:’4’
Write (‘Fin’)
6. [FIN DEL PSEUDOCÓDIGO]
@

SUMA DE 5 NUMEROS

1. [SUMA DE NO. ENTEROS]
2. [VARIABLES]
n1, n2, n3, n4, n5, suma: interger
3. [PEDIR DATOS]
Write (‘n1:’)
Read (n1)
Write (‘n2 :’)
Read (n2)
Write (‘n3 :’)
Read (n3)
Write (‘n4’)
Read (n4)
Write (‘n5 :’)
Read (n5)
4. [CALCULAR SUMA]
Suma n1+n2+n3n+n4+n5
5. [IMPRIMIR RESULTADOS]
Write (‘la suma de n números es: ‘suma)
6. [FIN DEL PSEUDOCÓDIGO]
@

NUMERO ENTEROS

1. [SUMA DE N]
Suma, número, i: enteros
2. [PEDIR DATOS]
Write (‘valor de n’)
Read (n)
Suma 0
3. [ESTABLECER CICLO DE REPETICIÓN]
For i==1 to i<=n
4. [PEDIR EL NUMERO]
Write (‘numero’)
Read (numero)
5. [CALCULAR LA SUMA]
Suma suma + numero
6. [IMPRIMIR DATOS]
Write (‘la suma de n números es:’ suma)
7. [FIN DEL PSEUDOCÓDIGO]
@

PROMEDIO ALUMNOS

1. [PROMEDIO]
2. [DECLARAR VARIABLES]
N, suma, i: entero
Calificación, promedio: real
3. [PEDIR DATOS]
Write (‘número de alumnos’)
Read (n)
Suma 0
4. [ESTABLECER CICLO DE REPETICIÓN]
For i == 1 to i<=n
5. [PEDIR LAS CALIFICACIONES]
Read (calificación)
6. [CALCULAR SUMA]
Suma suma + calificación
7. [CALCULAR PROMEDIO]
Promedio (suma/n)
8. [IMPRIMIR]
Write (‘el promedio de:’, n,’ alumnos es de:’, promedio)
9. [FIN PSEUDOCÓDIGO]
@

SUMA DE FRACCIONES

1. [SUMA DE FRACCIONES]
2. [DECLARAR VARIABLES]
N, suma, resultado, i: real
3. [PEDIR DATOS]
Write (‘pedir n’)
Read (n)
4. [INICIALIZAR SUMA]
Suma 1
5. [ESTABLECER CICLO DE REPETICIÓN]
For i== 2 to i<=n
6. [CALCULAR SUMA]
Suma suma + 1/i
7. [IMPRIMIR]
Write (‘la suma de 1 hasta 1sobre’,n, ‘es:’ suma)
8. [FIN DEL PSEUDOCÓDIGO]
@

TABLA MULTIPLICAR 1 - 10

1. [TABLA DE MULTIPLICAR]
2. [DECLARAR VARIABLES]
N, i, multiplicación,: real
3. [PEDIR DATOS]
Write (‘pedir n’)
Read (n)
4. [ESTABLECER CICLO DE REPETICIÓN]
For i==1 to i<=10
5. [CALCULAR MULTIPLICACION]
Multiplicación i*n
6. [IMPRIMIR]
Write (‘la tabla de multiplicar del numero’, n, ‘es’, multiplicación)
7. [FIN DEL PSEUDOCÓDIGO]
@

1 +2/2 + 3/3 + 4/4+ …n/n

1. [SUMA DE UNOS]
2. [DECLARAR VARIABLES]
N, i, suma: real
3. [PEDIR DATOS]
Write (‘pedir n’)
Read (n)
Suma 1
4. [INICIAR CICLO DE REPETICIÓN]
For i==2 to i<=n
5. [CALCULAR SUMA]
Suma suma+ i/i
6. [IMPRIMIR]
Write (‘la suma de unos es:’ suma)
7. [FIN DEL PSEUDOCÓDIGO]
@

1- 1/2*2+ 1/3*3 – 1/4*4 …1/n*n

1. [SUMA]
2. [DECLARAR VARIABLES]
N, suma, i, signo: real
3. [PEDIR DATOS]
Write (´pedir datos’)
Read (n)
Signo (-1)
4. [ESTABLECER CICLO DE REPETICIÓN]
For i==2 to i<=n
5. [CALCULAR OPERACIÓN]
Suma suma + (signo* i/i*i)
Signo signo*(-1)
6. [IMPRIMIR DATOS]
Write (‘la suma es:’ suma)
7. [FIN DEL PSEUDOCÓDIGO]
@

SUMA "N" NUMEROS

1. [SUMA DE N]
2. [DECLARAR VARIABLES]
Suma, numero, n, contador, resp: entero
3. [PEDIR DATOS]
Write (‘valor de n’)
Read (n)
Suma 0
4. [PEDIR DATOS DEL NUMERO]
Write (‘valor de del numero’)
Read (numero)
Write(‘no de numero’)
Read (resp)
5. [ESTABLECER CICLO DE REPETICIÓN]
While resp=>1 and resp<=n
6. [CALCULAR SUMA]
Suma suma + numero
While resp <1 or resp >n
7. [IMPRIMIR MENSAJE]
Write (‘Error’)
8. [FIN DEL PSEUDOCÓDIGO]
@

PROMEDIO TRIGONOMETRIA

1. [PROMEDIO]
2. [DECLARAR VARIABLES]
N, suma, resp: entero
Promedio, calificación: real
3. [PEDIR DATOS]
Write (‘número de alumnos:’)
Read (n)
Suma 0
4. [PEDIR NO DE ALUMNO]
Write (´no de alumno’)
Read (resp)
5. [ESTABLECER CICLO DE REPETICIÓN]
While resp>=1 and resp<=n
6. [PEDIR DATOS]
Write (‘calificacion’)
Read (calif)
Suma suma + calif
Promedio suma/n
7. [ESTABLECER CICLO]
While resp<1 or resp>n
8. [IMPRIMIR]
Write (‘Error’)

9. [IMPRIMIR DATOS]
Write (‘El promedio es:’ promedio)
10. [FIN DEL PSEUDOCÓDIGO]
@

SUMA DE FRACCIONES

1. [SUMA DE FRACCIONES]
2. [DECLARAR VARIABLES]
N, suma, resultado, resp: real
3. [PEDIR DATOS]
Write (’pedir n’)
Read (n)
4. [PEDIR DENOMINADOR]
Write (‘denominador’)
Read (resp)
5. [INICIALIZAR SUMA]
Suma 1
6. [ESTABLECER CICLO DE REPETICIÓN]
While resp>=2 and resp<=n
7. [CALCULAR SUMA]
Suma suma+ 1/i
8. [ESTABLECER CICLO DE REPETICIÓN]
While resp<1 or resp>n
9. [IMPRIMIR MENSAJE]
Write (‘error’)
10. [IMPRIMIR DATOS]
Write (‘la suma es de:’ suma)
11. [FIN DEL PSEUDOCÓDIGO]
@

TABLA MULTIPLICAR

1. [TABAL DE MULTIPLICAR]
2. [DECLARAR VARIABLES]
N, multiplicación, resp,: real
3. [PEDIR LIMITE]
Write (‘límite de la tabla’)
Read (n)
4. [PEDIR TABLA]
Write (‘tabla deseada’)
Read (resp)
5. [ESTABLECER CICLO DE REPETICIÓN]
While resp =>1 and resp <=n
6. [CALCULAR MULTIPLICACION]
Multiplicación n*10
7. [ESTABLECER CICLO DE REPETICION]
While resp <1 or resp >n
8. [IMPRIMIR MENSAJE DE ERROR]
Write (‘Error’)
9.[IMPRIMIR DATOS]
Write (‘la tabla de multiplicar es:’ multiplicación)
10.[FIN DEL PSEUDOCÓDIGO]
@

SUMA DE UNOS

1. [SUMA DE UNOS]
2. [DECLARAR VARIABLES]
N, suma, resp,: real
3. [PEDIR LIMITE]
Write (´limite´)
Read (n)
4. [PEDIR DENOMINADOR]
Write (‘denominador’)
Read (resp)
Suma 1
5. [ESTABLECER CICLO DE REPETICIÓN]
While resp=>2 and resp<=n
6. [CALCULAR SUMA]
Suma suma+ resp/resp
7. [ESTABLECER CICLO]
While resp<1 and resp>n
8. [IMPRIMIR MENSAJE DE ERROR]
Write (‘Error’)
9. [IMPRIMIR DATOS]
Write (‘la suma esd:’suma)
10. [FIN DEL PSEUDOCÓDIGO]
@

1- 1/2*2+ 1/3*3 – 1/4*4 …1/n*n

1. [SUMA]
2. [DECLARAR VARIABLES]
N, suma, resp, signo: real
3. [PEDIR DATOS]
Write (‘pedir datos’)
Read (n)
4. [PEDIR DENOMINADOR]
Write (‘denominador’)
Read (resp)
5. [ESTABLECER CICLO DE REPETICIÓN}
While resp=>2 and resp <=n
6. [CALCULAR SUMA]
Suma suma+(signo*1/resp*resp)
Signo signo*(-1)
7. [ESTABLECER CICLO]
While resp < 1 or resp > n
8. [IMPRIMIR MENSAJE]
Write (‘Error’)
9. [IMPRIMIR DATOS]
Write (‘el resultado es:’, suma)
10. [FIN DEL PSEUDOCÓDIGO]
@

Tiendita

1. [Tiendita]
2. [Declarar variables]
Resp: chart
Nomprod: strin [15]
Cant: int
Precio, importe, suma, total: real
3. [Pedir datos]
Write (‘desea hacer una compra S/N’)
Read (respuesta)
4. [Inicializar suma]
Suma 0
5. [Establecer ciclo]
While resp==S or resp==chart (83) or resp! =S or resp! =chart (83)
6. [Establecer ciclo]
While resp<>S or resp<> respchar (83) and resp<>N or resp<> char (78)
7. [Imprimir datos]
Write (‘Error)
8. [Pedir datos]
Write (‘desea hacer una compra S/N’)
Read (resp)
9. [Establecer ciclo]
While resp ==n or resp==chart 78
10. [Imprimir]
Write (‘gracias por su compra’)
11. [Pedir datos]
Write (‘desea hacer una compra’)
Read (resp)
12. [Establecer ciclo}
While resp ==S or resp==char (83)
13. [Pedir datos]
Write (‘nombre del producto’)
Read (nom prod)
Write (‘precio’)
Read (precio)
Write (‘cantidad’)
Read (cant)
14. [Calcular]
Importe precio*cant
Suma suma+importe
Total suma
15. [Preguntar]
Write (‘desea comprar’)
Read (resp)
16. [Imprimir]
Write (‘total:’ total)
17. [Fin del pseudocódigo]
@

CAFETERIA

FIGURAS GEOMETRICAS

TIENDITA DE LA ESQUINA

FORMULA

FACTORIAL

EXPONENTE 4

GASOLINERA

BOLETA CALIFICACIONES

NUMERO MAYOR

PEPSICO

TRES NUMEROS POSITIVOS ENTEROS

5 NUMEROS ENTEROS

SUMA DE NUMEROS ENTEROS

PROMEDIO

SUMA DE FRACCIONES

TABLAS DE MULTIPLICAR 1 - 10

1 +2/2 + 3/3 + 4/4+ …n/n

1- 1/2*2+ 1/3*3 – 1/4*4 …1/n*n.