ALGORITMO QUE CALCULE LA MASA CORPORAL DE UNA PERSONA [ IMC ]

Categoría de Estructura Condicional Simple


Calcular el índice de masa corporal ( IMC ) en pseint.

💻 En un centro médico se desea implementar un programa en pseint para calcular el índice de masa corporal (IMC), implementado la siguiente formula [ IMC = Peso kg. / (estatura m.)2 ].

Diseñe un algoritmo que realice el cálculo el IMC y determine el estado de la persona:

Varones | Estado | Mujeres
---------------------------------------
Menor 20 | Desnutrición | Menor 19
20 - 24.9 | Normalidad | 19 - 23
25 - 29.9 | Sobrepeso | 24 - 27
30 - 40 | Obesidad | 27 - 32
Mayor 40 | Obesidad Grave | Mayor 32


Análisis del código:

Para este programa se requiere tener 3 datos importantes como el sexo, la talla y el peso de una persona para conocer su masa corporal.

Ejemplo : Ingresamos como datos sexo masculino, con una talla de 1.70 y un peso de 65 kilos.
01. Primero ingresamos sexo : sexo = "H"
02. Segundo ingresamos el peso : peso = 65
03. Tercero ingresamos la talla : talla = 1.70
04. Formula para obtener el IMC : IMC = peso/(talla x talla)
05. Aplicando la formula : IMC = 65/(1.70 x 1.70) = 22.49 de masa
06. Su masa corporal es de IMC 22.49
07. Siendo el IMC 22.49 y su sexo hombre su estado seria de "NORMALIDAD" según nuestra tabla.


Algoritmo que calcule el monto a pagar en pseint PSeInt Estricto : DESCARGA EL CÓDIGO

algoritmo que calcule el IGV

Algoritmo en pseint - short youtube
Algoritmo programacion_work  
    Definir sexo, estado como Caracter;
    Definir peso, altu, IMC como Real;        
    IMC <- 0;	
    Escribir Sin Saltar "PESO : ";
    Leer peso;
    Escribir Sin Saltar "ALTURA EN METROS : ";
    Leer altu;
    sexo <- "";
    Mientras sexo <> "H" y sexo <> "M" Hacer
        Escribir Sin Saltar "SEXO [H - M] : ";
        Leer sexo;	
    FinMientras
    IMC <- peso / (altu * altu);
    Si(MAYUSCULAS(sexo) == "H") Entonces
        Si (IMC < 20) Entonces
            estado <- "DESNUTRICIÓN";
        SiNo
            Si (IMC >= 20 y IMC <= 24.9) Entonces
                estado <- "NORMALIDAD";
            SiNo
                Si (IMC >= 25 y IMC <= 29.9) Entonces
                    estado <- "SOBREPESO";
                SiNo
                    Si (IMC >= 30 y IMC <= 40) Entonces
                        estado <- "OBESIDAD";
                    SiNo
                        estado <- "OBESIDAD GRAVE";
                    FinSi
                FinSi
            FinSi
        FinSi
    SiNo
        Si (IMC < 19) Entonces
            estado <-"DESNUTRICIÓN";
        SiNo
            Si (IMC >= 19 y IMC <= 23) Entonces
                estado <- "NORMALIDAD";
            SiNo
                Si (IMC >= 24 y IMC <= 27) Entonces
                    estado <- "SOBREPESO";
                SiNo
                    Si (IMC >= 27 y IMC <= 32) Entonces
                        estado <- "OBESIDAD";
                    SiNo
                        estado <- "OBESIDAD GRAVE";
                    FinSi
                FinSi
            FinSi
        FinSi
    FinSi
    Escribir "";
    Escribir "IMC : ",IMC;
    Escribir "EL ESTADO DE SU CONDICIÓN ES : ",estado;
FinProceso
muestre el IMC en pseint

Mostrar el sueldo de un empleado en pseint PSeInt Flexible :

Algoritmo programacion_work  
    Escribir Sin Saltar "PESO : "
    Leer peso
    Escribir Sin Saltar "ALTURA EN METROS : ";
    Leer altu
    Escribir Sin Saltar "SEXO [H - M] : "
    Leer sexo
    IMC = peso / (altu * altu);
    Si(MAYUSCULAS(sexo) == "H") Entonces
        Si (IMC < 20) Entonces
            estado = "DESNUTRICIÓN"
        SiNo
            Si (IMC >= 20 y IMC <= 24.9) Entonces
                estado = "NORMALIDAD"
            SiNo
                Si (IMC >= 25 y IMC <= 29.9) Entonces
                    estado = "SOBREPESO"
                SiNo
                    Si (IMC >= 30 y IMC <= 40) Entonces
                        estado = "OBESIDAD"
                    SiNo
                        estado = "OBESIDAD GRAVE"
                    FinSi
                FinSi
            FinSi
        FinSi
    SiNo
        Si (IMC < 19) Entonces
            estado = "DESNUTRICIÓN"
        SiNo
            Si (IMC >= 19 y IMC <= 23) Entonces
                estado = "NORMALIDAD"
            SiNo
                Si (IMC >= 24 y IMC <= 27) Entonces
                    estado = "SOBREPESO"
                SiNo
                    Si (IMC > 27 y IMC <= 32) Entonces
                        estado = "OBESIDAD"
                    SiNo
                        estado = "OBESIDAD GRAVE"
                    FinSi
                FinSi
            FinSi
        FinSi
    FinSi
    Escribir ""
    Escribir "IMC : ",IMC
    Escribir "EL ESTADO DE SU CONDICIÓN ES : ",estado
FinAlgoritmo



Facebook de www.programacion.work. Canal de Youtube de www.programacion.work. Twitter de www.programacion.work. TikTok de www.programacion.work.


Política de cookies

Política de Privacidad

Aviso Legal y Términos De Uso