martes, 19 de junio de 2012

SEUDOCÓDIGO

Ejemplos de Pseudocódigo

Ejemplo: Realizar el pseudocódigo de un programa que permita calcular el área de un rectángulo. Se debe introducir la base y la altura para poder realizar el cálculo..
Programa; área
Entorno: BASE, ALTURA, AREA son número enteros
Algoritmo:
            escribir “Introduzca la base y la altura”
            leer BASE, ALTURA
            calcular AREA = BASE * ALTURA
            escribir “El área del rectángulo es “AREA
Finprograma
Ejemplo: Realizar el pseudocódigo que permita al usuario introducir por teclado dos notas, calculando la suma y el producto de las notas.
Programa: SumaProducto
Entorno: NOTA1,NOTA2,SUMA,PRODUCTO son números enteros
Algoritmo:
escribir “Introduzca las notas”
leer NOTA1,NOTA2
calcular SUMA = NOTA1 + NOTA2
calcular PRODUCTO = NOTA1 * NOTA2
escribir “La suma de las dos notas es:” SUMA
escribir “El producto de las dos notas es :”PRODUCTO
Finprograma

Ejemplo: Realizar el pseudocódigo de un programa que permita saber si un número es mayor, menor o igual a cero.
    Programa: ComparaNúmeros
       Entorno: NUMERO es un número entero
Algoritmo:
Escribir “Introduzca un número “
leer NUMERO
SI NUMERO>0  ENTONCES
          escribir “El número introducido es positivo”
SI NO
          SI NUMERO<0 ENTONCES
                 escribir “El número introducido es negativo”
          SI NO
                 escribir “El número es cero”
          FINSI
FINSI
Finprograma



COPIAR EN ELPROGRAMA PSEINT Y VERIFICAR INSTRUCCIÓN REPETIR.

INVESTIGAR UNA DE LAS INSTRUCCIONES QUE FALTAN, A APLICARLA EN UN EJERCICIO


Proceso OPERACIONES_BASICAS
    Escribir "PROGRMA PARA REALIZAR OPERACIONES BASICAS";   
    Escribir "DE DOS NUMEROS";
    Escribir "----------------------------------------";
    Escribir "INGRESE EL 1ER NUMERO";
    Leer N1;
    Escribir "INGRESE EL 2DO NUMERO";
    Leer N2;
    SUMA<-N1+N2;
    RESTA<-N1-N2;
    DIV1<-N1/N2;
    MUL1<-N1*N2;
    Escribir "LA SUMA ES...";
    Escribir SUMA;
    Escribir "LA RESTA ES...";
    Escribir RESTA;
    Escribir "LA DIVISION...";
    Escribir DIV1;
    Escribir "LA MULTIPLICACION ES...";
    Escribir MUL1;
    Escribir "---------------------------------------";
    Escribir "PROGRAMA HECHO POR L.A.M.R";
 FinProceso

Proceso OPERACIONES_BASICAS_REPETIR
    Escribir "PROGRMA PARA REALIZAR OPERACIONES BASICAS";   
    Escribir "DE DOS NUMEROS";
    Escribir "----------------------------------------";
    R<-0;
    Repetir
        Escribir "INGRESE EL 1ER NUMERO";
        Leer N1;
        Escribir "INGRESE EL 2DO NUMERO";
        Leer N2;
        SUMA<-N1+N2;
        RESTA<-N1-N2;
        DIV1<-N1/N2;
        MUL1<-N1*N2;
        Escribir "LA SUMA ES...";
        Escribir SUMA;
        Escribir "LA RESTA ES...";
        Escribir RESTA;
        Escribir "LA DIVISION...";
        Escribir DIV1;
        Escribir "LA MULTIPLICACION ES...";
        Escribir MUL1;
        R<-R+1;
        Escribir "REPETICION...";
        Escribir R;
        Escribir "---------------------------------------";
    Hasta Que R=3
    Escribir "PROGRAMA HECHO POR L.A.M.R";
FinProceso

No hay comentarios:

Publicar un comentario