Sie sind auf Seite 1von 4

Algoritmos y lenguajes de programación

Desarrollo de algoritmo con Pseudocódigo.

I.- Elabore un algoritmo utilizado Psedocodigo para efectuar las operaciones que se muestran en el siguiente menú. Y de
igual manera efectuar el código básico en lenguaje C++ del algoritmo propuesto

¿QUE OPERACION DESEA HACER?

1.-SUMA DE DOS NUMEROS

2.-RESTA DE DOS NUMEROS

3.-MULTIPLICACIÓN DE DOS NUMEROS

4.-DIVISION DE DOS NUMEROS

5.- SALIR

ELIJA LA OPCIÓN:

ALGORITMO CON PSEUDOCODIGO

1.-INICIO

2.-ESCRIBIR “¿Qué DESEA HACER?”

3.-ESCRIBIR “1.-SUMA DE DOS NUMEROS”

4.-ESCRIBIR “2.-RESTA DE DOS NUMEROS”

5.-ESCRIBIR “3.-MULTIPLICACIÓN DE DOS NUMEROS”

6.-ESCRIBIR “4.-DIVISION DE DOS NUMEROS”

7.-ESCRIBIR “5.- SALIR”

8.-LEER OPCIÓN

9.-LEER NUM1

10.-LEER NUM 2

11.-SI OPCIÓN = 1 ENTONCES

11.1 OPERACIÓN=NUM1+NUM2

11.2 ESCRIBIR “LA SUMA DE LOS NUMEROS ES:”, OPERACIÓN

FIN SI

12.-SI OPCIÓN = 2 ENTONCES

12.1 OPERACIÓN=NUM1-NUM2
Algoritmos y lenguajes de programación
12.2 ESCRIBIR “LA RESTA DE LOS NUMEROS ES:”, OPERACIÓN

FIN SI

13.-SI OPCIÓN = 3 ENTONCES

13.1 OPERACIÓN=NUM1*NUM2

13.2 ESCRIBIR “LA MULTIPLICACIÓN DE LOS NUMEROS ES:”, OPERACIÓN

FIN SI

14.-SI OPCIÓN = 4 ENTONCES

14.1 OPERACIÓN=NUM1/NUM2

14.2 ESCRIBIR “LA DIVISIÓN DE LOS NUMEROS ES:”, OPERACIÓN

FIN SI

15. FIN

CODIGO EN LENGUAJE C++

#include <stdio.h>

#include <conio.h>

int main(void)

////////////////////////////////

////DECLARACION DE VARIABLES////

////////////////////////////////

int Opcion=0,Num1=0,Num2=0,Operacion=0;

Opcion=1;

while(Opcion<5)
Algoritmos y lenguajes de programación
{

printf("\n\t ++++++++++++++++++++++++++++");

printf("\n\t ¿QUE OPERACION DESEA HACER?");

printf("\n\t ++++++++++++++++++++++++++++");

printf("\n\t1.-SUMA DE DOS NUMEROS");

printf("\n\t2.-RESTA DE DOS NUMEROS");

printf("\n\t3.-MULTIPLICACIÓN DE DOS NUMEROS");

printf("\n\t4.-DIVISION DE DOS NUMEROS");

printf("\n\tCAPTURE LA OPCION QUE QUIERE EFECTUAR:");

scanf("%d",&Opcion);

//CIERRE DE IF AUXILIAR PARA SABER SI SE SELECCIONO UNA OPCIÓN VALIDA DEL MENU

if(Opcion<5){

printf("\n\tCAPTURE EL PRIMER NUMERO:");

scanf("%d",&Num1);

printf("\n\tCAPTURE EL SEGUNDO NUMERO:");

scanf("%d",&Num2);

//SECCIÓN DE SUMA DE DOS NUMEROS

if(Opcion==1){

Operacion=Num1+Num2;

printf("\n\tLA SUMA DE LOS NUMEROS %d + %d ES: %d",Num1, Num2, Operacion);

//SECCIÓN DE RESTA DE DOS NUMEROS


Algoritmos y lenguajes de programación
if(Opcion==2){

Operacion=Num1-Num2;

printf("\n\tLA RESTA DE LOS NUMEROS %d - %d ES: %d",Num1, Num2, Operacion);

//SECCIÓN DE MULTIPLICACIÓN DE DOS NUMEROS

if(Opcion==3){

Operacion=Num1*Num2;

printf("\n\tLA LA MULTIMPLICACION DE LOS NUMEROS %d * %d ES: %d",Num1, Num2, Operacion);

//SECCIÓN DE DIVISIÓNN DE DOS NUMEROS

if(Opcion==4){

Operacion=Num1/Num2;

printf("\n\tLA LA DIVISIÓN DE LOS NUMEROS %d / %d ES: %d",Num1, Num2, Operacion);

} else {

printf("\n\tSE SELECCIONO UNA OPCIÓN NO VALIDA PARA O DESEA SALIR");

}//CIERRE DE IF AUXILIAR

} //CIERRE DE CLICLO WHILE (MIENTRAS)

return 0;

Das könnte Ihnen auch gefallen