Está en la página 1de 26

ANÁLISIS Y DESARROLLO DE SISTEMAS DE INFORMACIÓN.

ALGORITMOS TALLER NUMERO 2.

1. Diseñe un programa con un según para seleccionar con un menú las 6 operaciones básicas
matemáticas suma resta multiplicación división cuadrado y porcentaje.

Proceso TALLER_2_EJERCICIO_1
//DEFINIR VARIABLES
Definir Opc, Num1, Num2, Res, Salir Como Real;

//ASIGNAR VALORES
Opc<-0;

Repetir
// HACER MENU
Escribir "OPERACIONES MATEMATICAS";
Escribir "";
Escribir "1. SUMA";
Escribir "2. RESTA";
Escribir "3. MULTIPLICACION";
Escribir "4. DIVISION";
Escribir "5. RAIZ CUADRADA";
Escribir "6. PORCENTAJE";
Escribir "";
Escribir "DIGITE LA OPERACION DESEADA" Sin Saltar;
Leer Opc;
Escribir "";
Escribir "";
Segun opc Hacer
1:
Escribir 'DIGITE EL PRIMER NUMERO A SUMAR' Sin Saltar;
Leer Num1;
Escribir 'DIGITE EL SEGUNDO NUMERO A SUMAR' Sin Saltar;
Leer Num2;
// OPERACION MATEMATICA
Res <- Num1+Num2;
Escribir '';
Escribir '';
// RESULTADO
Escribir 'LA SUMA DE SU NUMERO ',Num1,' MAS SU NUMERO ',Num2,' ES ',Res;
Escribir "";
2:
Escribir Sin Saltar "DIGITE EL PRIMER NUMERO A RESTAR";
Leer Num1;
Escribir Sin Saltar "DIGITE EL SEGUNDO NUMERO A RESTAR";
Leer Num2;
//OPERACION MATEMATICA
Res = Num1-Num2;
Escribir "";
Escribir "";
//RESULTADO
Escribir "LA RESTA DE SU NUMERO ",Num1, " MENOS SU NUMERO ",Num2, " ES ",Res;
Escribir "";
3:
Escribir Sin Saltar "DIGITE EL PRIMER NUMERO A MULTIPLICAR";
Leer Num1;
Escribir Sin Saltar "DIGITE EL SEGUNDO NUMERO A MULTIPLICAR";
Leer Num2;
Escribir "";
Escribir "";
//OPERACION MATEMATICA
Res = Num1*Num2;
//RESULTADO
Escribir "LA MULTIPLICACION DE SU NUMERO ",Num1, " POR SU NUMERO ",Num2, " ES ",Res;
Escribir "";
4:
Escribir Sin Saltar "DIGITE EL PRIMER NUMERO A DIVIDIR";
Leer Num1;
Escribir Sin Saltar "DIGITE EL SEGUNDO NUMERO A DIVIDIR";
Leer Num2;

//OPERACION MATEMATICA
Si Num2=0 Entonces
Escribir "ERROR DIVISION POR 0";
SiNo
Res = Num1/Num2;
Escribir "LA DIVISION DE SU NUMERO ",Num1, " SOBRE SU NUMERO ",Num2, " ES ",Res;
FinSi
Escribir "";
5:
Escribir Sin Saltar "DIGITE UN NUMERO ";
Leer Num1;
//OPERACION MATEMATICA
Res=rc(Num1);
//RESULTADO
Escribir "LA RAIZ CUADRADA DE ",Num1, " ES ",Res;
Escribir "";
6:
Escribir Sin Saltar "DIGITE UN NUMERO ";
Leer Num1;
Escribir Sin Saltar "DIGITE EL PORCENTAJE ";
Leer Num2;
//OPERACION MATEMATICA
Res=(Num1*Num2)/100;
//RESULTADO
Escribir "EL ", Num2, "% DE ",Num1, " ES ",Res;
Escribir "";
De Otro Modo:
Escribir "OPCION INVALIDA";
Escribir "";
FinSegun
Escribir Sin Saltar "DIGITE 1 SI DESEA ESCOGER OTRA OPERACION MATEMATICA ";
Leer Salir;
Borrar Pantalla;
Hasta Que Salir<>1
FinProceso
2. Diseñe un programa que por teclado solicite la cantidad de números que se desea ver de la
serie de Fibonacci (sucesión de Fibonacci).

Proceso TALLER_2_EJERCICIO_2
//DEFINIR VARIABLES
Definir Num, Num1, Num2, Res, Cont, Salir Como Real;

Repetir
//ASIGNAR VALORES
Num1<-1;
Num2<-0;
Escribir "INGRESE NUMERO";
Leer Num;
Para Cont<-1 Hasta Num Hacer
Res=Num1+Num2;
Num1=Num2;
Num2=Res;
Escribir Num2;
FinPara
Escribir Sin Saltar "DIGITE 1 SI DESEA HACERLO CON OTRO NUMERO ";
Leer Salir;
Borrar Pantalla;
Hasta Que Salir<>1
FinProceso
3. Diseñe un programa que por teclado solicite un número y encuentre su factorial.
Proceso TALLER_2_EJERCICIO_3
Definir Fact, Num, Cont, Salir Como Real;
//ASIGNAR VALORES
Fact=1;
Repetir
Escribir Sin Saltar "INGRESE NUMERO ";
Leer Num;
Para Cont=1 Hasta Num Hacer
Fact=Fact*Cont;
Escribir Fact;
FinPara
Escribir Sin Saltar "DIGITE 1 SI DESEA HACERLO CON OTRO NUMERO ";
Leer Salir;
Borrar Pantalla;
Hasta Que Salir<>1
FinProceso
4. Diseñe un programa que por teclado solicite una acción y que muestre 6 números
aleatorios del 1 al 45 sin repetirse y organizados de menor a mayor (baloto).
Proceso TALLER_2_EJERCICIO_4
//DEFINIR VARIABLES
definir Num1, Num2, Num3, Num4, Num5, Num6, Cont, i, Salir Como Entero;
//ASIGNAR VALORES
cont <-0;
Num1 <-0;
Num2 <-0;
Num3 <-0;
Num4 <-0;
Num5 <-0;
Num6 <-0;
Repetir
Escribir sin saltar "BALOTO";
Escribir "";
Escribir "OPRIMA UNA TECLA PARA INICIA EL BALOTO";
Esperar tecla;
//CICLO DE NUMEROS
Num1 <- azar(45) + 1;
Repetir
Num2 <- azar(45) + 1;
Hasta Que Num1 <> Num2;
Repetir
Num3 <- azar(45) + 1;
Hasta Que Num3 <> Num1 Y Num3 <> Num2;
Repetir
Num4 <- azar(45) + 1;
Hasta Que Num4 <> Num1 Y Num3 <> Num2 Y Num4 <> Num3;
Repetir
Num5 <- azar(45) + 1;
Hasta Que Num5 <> num1 Y num5 <> num2 Y num5 <> num3 Y num5 <> num4;
Repetir
num6 <- azar(45) + 1;
Hasta Que Num6 <> Num1 Y Num6 <> Num2 Y Num6 <> Num3 Y Num6 <> Num4 Y Num6 <> Num5;
//ASIGNAR VALORES
Para i<-0 Hasta 6 Con Paso 1 Hacer
Si Num1 >= Num2 Entonces
Cont<-Num1;
Num1<-Num2;
Num2<-Cont;
FinSi
Si Num2 >= Num3 Entonces
Cont<-Num2;
Num2<-Num3;
Num3<-Cont;
FinSi
Si Num3 >= num4 Entonces
Cont<-Num3;
Num3<-Num4;
Num4<-Cont;
FinSi
Si Num4 >= Num5 Entonces
Cont<-num4;
Num4<-num5;
Num5<-cont;
FinSi
Si Num5 >= Num6 Entonces
Cont<-Num5;
Num5<-Num6;
Num6<-Cont;
FinSi
FinPara
Escribir "";
Escribir "BALOTA 1: ",Num1;
Escribir "BALOTA 2; ",Num2;
Escribir "BALOTA 3: ",Num3;
Escribir "BALOTA 4: ",Num4;
Escribir "BALOTA 5: ",Num5;
Escribir "BALOTA 6: ",Num6;
Escribir "";
Escribir "OPRIMA 1 SI DESEA OTROS NUMEROS PARA EL BALOTO ";
leer Salir;
Hasta Que Salir <>1
FinProceso
5. Diseñe un programa que por teclado solicite tres números y que según la decisión del
usuario los organice de forma ascendente o descendente.

Proceso Taller2_ejercicio5
//ASiGNAR VARIABLES
Definir NUM1, NUM2, NUM3, Salir Como Real;
Definir Orden Como Texto;
Repetir
Escribir "INGRESE 3 NUMEROS";
Leer NUM1;
Leer NUM2;
Leer NUM3;
Escribir "COMO DESEA ORDENAR ASCEDENTE O DESCENDENTE";
Leer Orden;
Si Orden = "descendente" O Orden = "DESCENDENTE" entonces
Escribir "DESECENDENTE";
Escribir "";
Si NUM1>NUM2 Y NUM1>NUM3 Entonces
Escribir NUM1;
Escribir "";
Si NUM2 > NUM3 Entonces
Escribir NUM2;
Escribir "";
Escribir NUM3;
Escribir "";
SiNo
Escribir NUM3;
Escribir "";
Escribir NUM2;
Escribir "";
FinSi
Sino
Si NUM2 > NUM1 Y NUM2 > NUM3 Entonces
Escribir NUM2;
Escribir "";
Si NUM1 > NUM3 Entonces
Escribir NUM1;
Escribir "";
Escribir NUM3;
Escribir "";
SiNo
Escribir NUM3;
Escribir "";
Escribir NUM1;
Escribir "";
FinSi
Sino
Escribir NUM3;
Escribir "";
Si NUM1>NUM2 Entonces
Escribir NUM1;
Escribir "";
Escribir NUM2;
Escribir "";
Sino
Escribir NUM2;
Escribir "";
Escribir NUM1;
Escribir "";
FinSi
FinSi
FinSi
SiNo
Escribir "ASCENDENTE";
Escribir "";
Si Orden = "ascendente" O Orden = "ASCENDENTE" entonces
Si NUM1 < NUM2 Y NUM1 < NUM3 Entonces
Escribir NUM1;
Escribir "";
Si NUM2 < NUM3 Entonces
Escribir NUM2;
Escribir "";
Escribir NUM3;
Escribir "";
SiNo
Escribir NUM3;
Escribir "";
Escribir NUM2;
Escribir "";
FinSi
Sino
Si NUM2 < NUM1 Y NUM2 < NUM3 Entonces
Escribir NUM2;
Escribir "";
Si NUM1 < NUM3 Entonces
Escribir NUM1;
Escribir "";
Escribir NUM3;
Escribir "";
SiNo
Escribir NUM3;
Escribir "";
Escribir NUM1;
Escribir "";
FinSi
Sino
Escribir NUM3;
Escribir "";
Si NUM1<NUM2 Entonces
Escribir NUM1;
Escribir "";
Escribir NUM2;
Escribir "";
Sino
Escribir NUM2;
Escribir "";
Escribir NUM1;
Escribir "";
FinSi
FinSi
FinSi
SiNo
Escribir "NO HA SELECCIONADO SI ASCENDENTE O DESCENDENTE";
FinSi
FinSi
Escribir 'DIGITE 1 Si DESEA HACERLO CON OTRO NUMERO ' Sin Saltar;
Leer Salir;
Borrar Pantalla;
Hasta Que Salir<>1
FinProceso

6. Diseñe un programa que solicite un numero por teclado encuentre cuantos dígitos tiene y
lo descomponga y muestre en pantalla.

Proceso TALLER_2_EJERCICIO_6
//ASIGNAR VARIABLES
Definir Num, Conum, Aux, i, Pot, Dig , Salir Como Real;;
Conum=0;
Repetir
Escribir "CONTAR DIGITOS";
Escribir "";
Escribir Sin Saltar"INGRESE UN NUMERO ";
Leer Num;
Aux <- Num;
Mientras Aux>0 hacer
Conum <- Conum + 1;
Aux <- Trunc(Aux/10);
FinMientras
Escribir "EL NUMERO CONTIENE ",Conum," DIGITOS";
Aux<-Num;
//OBTENCION DE DIGITO
Para i<-1 hasta Conum Hacer
Pot<-10^(Conum-i);
Dig <- Trunc (aux / Pot);
aux <- aux - Dig*Pot;
Escribir "EL DIGITO ",i," ES ",Dig;
FinPara
Escribir Sin Saltar "DIGITE 1 SI DESEA DESGLOSAR OTRO NUMERO";
Leer Salir;
Hasta Que Salir<>1
FinProceso
7. Diseñe un programa que solicite 2 números por teclado, luego indique al usuario si desea
la serie par o impar, después muestre en pantalla la serie par o impar según la elección
desde el número menor que se ingresó al inicio hasta el número mayor.

Proceso TALLER_2_EJERCICIO_7
//DEFINIR VARIABLES
Definir Num1, Num2, Salir Como Real;
Definir Sec como caracter;
//ASIGNAR VALORES
Num1<-0;
Num2<-0;
Sec<-"";
Repetir
Limpiar Pantalla;
Escribir "PARES O IMPARES";
Escribir "";
//INGRESAR DATOS
Escribir Sin Saltar"DIGITE UN NUMERO";
Leer Num1;
Escribir Sin Saltar "DIGITE UN NUMERO MAYOR";
leer Num2;
Escribir Sin Saltar "QUE SECUENCIA DESEA PAR O IMPAR";
Leer Sec;
Si Sec="par" O Sec="PAR" Entonces
Para Num1<-Num1 Hasta Num2 hacer
Si Num1 Mod 2=0 Entonces
Escribir Num1;
Finsi
FinPara
SiNo
Escribir "ERROR AL DIGITAR SECUENCIA ";
FinSi
Si Sec="impar" O Sec="IMPAR" Entonces
Para Num1<-Num1 Hasta Num2 hacer
Si Num1 Mod 2<>0 Entonces
Escribir Num1;
FinSi
FinPara
FinSi
Escribir Sin Saltar "DIGITE 1 SI DESEA OTRA SECUENCIA ";
Leer Salir;
Hasta Que Salir<>1
FinProceso
8. Diseñe un programa que solicite por pantalla dos colores primarios y en pantalla salga la
combinación de los dos colores.

Proceso combinacion_de_colores
//DECLARAR VARIABLES
Definir Col1, Col2 como caracter;
Definir Salir Como Real;
Col1<-"";
Col2<-"";
//ASIGNAR VALORES
Escribir "COLORES PRIMARIOS";
Escribir "";
Escribir Sin Saltar "INGRESE UN COLOR PRIMARIO";
leer Col1;
Escribir "";
Escribir Sin Saltar "INGRESE UN DIFERENTE COLOR";
Leer Col2;
Escribir "";
Repetir
Si (Col1 <> "AMARILLO" Y Col2<>"AMARILLO" Y Col1<>"AZUL" Y Col2<>"AZUL" Y Col1<>"ROJO" Y Col2<>"ROJO") entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="AMARILLO" Y Col2<>"AMARILLO" Y Col2<>"AZUL" Y Col2<>"ROJO" entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="ROJO" Y Col2="AZUL" entonces
Escribir "EL COLOR QUE SE COMBINO ES MORADO";
Escribir "";
Finsi
FinSi
FinSi
Si (Col1 <> "AMARILLO" Y Col2<>"AMARILLO" Y Col1<>"AZUL" Y Col2<>"AZUL" Y Col1<>"ROJO" Y Col2<>"ROJO") entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="AZUL" Y Col2="ROJO " Entonces
Escribir "EL COLOR QUE SE COMBINO ES MORADO";
Escribir "";
FinSi
FinSi
Si (Col1 <> "AMARILLO" Y Col2<>"AMARILLO" Y Col1<>"AZUL" Y Col2<>"AZUL" Y Col1<>"ROJO" Y Col2<>"ROJO") entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="AMARILLO" Y Col2<>"AMARILLO" Y Col2<>"AZUL" Y Col2<>"ROJO" entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="ROJO" Y Col2="AMARILLO" entonces
Escribir "EL COLOR QUE SE COMBINO ES ANARANJADO";
Escribir "";
Finsi
FinSi
Si (Col1 <> "AMARILLO" Y Col2<>"AMARILLO" Y Col1<>"AZUL" Y Col2<>"AZUL" Y Col1<>"ROJO" Y Col2<>"ROJO") entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="AMARILLO" Y Col2="ROJO" Entonces
Escribir "EL COLOR QUE SE COMBINO ES ANARANJADO";
Escribir "";
FinSi
FinSi
Si (Col1 <> "AMARILLO" Y Col2<>"AMARILLO" Y Col1<>"AZUL" Y Col2<>"AZUL" Y Col1<>"ROJO" Y Col2<>"ROJO") entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="AMARILLO" Y Col2<>"AMARILLO" Y Col2<>"AZUL" Y Col2<>"ROJO" entonces
Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";
Sino
Si Col1="AMARILLO" Y Col2="AZUL" entonces
Escribir "EL COLOR QUE SE COMBINO ES VERDE";
Escribir "";
Finsi
FinSi
Si (Col1 <> "AMARILLO" Y Col2<>"AMARILLO" Y Col1<>"AZUL" Y Col2<>"AZUL" Y Col1<>"ROJO" Y Col2<>"ROJO") entonces

Escribir "EL COLOR QUE INGRESO NO ES PRIMARIO";


Sino
Si Col1="AZUL" Y Col2="AMARILLO" Entonces
Escribir "EL COLOR QUE SE COMBINO ES VERDE";
Escribir "";
FinSi
FinSi
FinSi
FinSi
Escribir 'DIGITE 1 SI DESEA HACER EL FACTORIAL CON OTRO NUMERO ' Sin Saltar;
Leer Salir;
Borrar Pantalla;
Hasta Que Salir<>1
FinProceso
9. Diseñe un programa que llene un vector de 10 posiciones con un ciclo para, luego imprima
con otro ciclo el vector mostrando el índice, la posición y el valor.

Proceso TALLER_2_EJERCICIO_9
Definir Vec, i, Salir como real;
Dimension Vec[11];
Repetir
Escribir "VECTOR";
Escribir "";
Para i<-1 Hasta 10 Con Paso 1 Hacer
Escribir SinSaltar "NUMERO ", i;
Leer Vec[i];
FinPara
i=1;
Escribir "";
Escribir "";
Para i<-1 Hasta 10 Con Paso 1 Hacer
Escribir i, ". POSICION ", i, " VALOR ", Vec[i];
FinPara
Escribir "";
Escribir "";
Escribir Sin Saltar "DIGITE 1 SE DESEA LLENAR OTRO VECTOR ";
Leer Salir;
Borrar Pantalla;
Hasta Que Salir<>1
FinProceso
10. Diseñe un programa que permita jugar guayabita, primero se ingresaran la cantidad de
Todos los programas deben repetirse (dentro de un ciclo hasta que el usuario decida
acabarlo con un menú) ejemplo: para repetir el programa marque 1 de lo contrario otro
número.

Proceso TALLER_2_EJERCICIO_10
Definir NumJug, Jug, Acum, Numer1, Numer2, Salir Como real;
Repetir
Limpiar Pantalla;
Escribir "GUAYABITA";
Escribir "";
Escribir Sin Saltar "NUMEROS DE JUGADORES ";
Leer NumJug;
Escribir "";
Escribir "";
Acum=NumJug;
Jug=1;
Repetir
Si jug>numjug entonces
jug=1;
SiNo
Limpiar Pantalla;
Escribir "JUGADOR ", Jug, " ", "ACUMULADO ", Acum, " PESOS";
Escribir "";
Escribir "OPRIMA UNA TECLA";
Esperar tecla;
Escribir "";
Escribir "";
Numer1<-azar(6)+1;
Escribir "PRIMER NUMERO ", Numer1;
Esperar tecla;
Si Numer1=1 o Numer1=6 Entonces
Acum=Acum+1;
Escribir "";
Escribir "ACUMULADO ", Acum, " PESOS";
Jug=Jug+1;
SiNo
Numer2<-azar(6)+1;
Escribir "SEGUNDO NUMERO ", Numer2;
Si Numer2>Numer1 Entonces
Escribir "";
Escribir "";
Escribir " GANA EL ACUMULADO ", Acum, " PESOS";
Acum=0;
SiNo
Escribir "";
Acum=Acum+Acum;
Escribir "ACUMULADO ", Acum, " PESOS";
Jug=Jug+1;
FinSi
Escribir "";
FinSi
Escribir "";
Esperar Tecla;
FinSi
Hasta Que Acum=0
Escribir Sin Saltar "DIGITE 1 SI DESEA CONTINUAR JUGANDO ";
Leer Salir;
Hasta Que Salir<>1;
FinProceso

También podría gustarte