# How do I solve this type of exercise in pseint

2

Based on the statement, you must present a modular algorithm (without using fixes) that satisfies the objectives indicated below. STATEMENT: To capture the names and ages of 10 people fulfilling the following objectives: 1.- Implement cycle While

2.- Determine and show the average age of all people

3.- Determine and show the percentage of minors

4.- Determine and show the younger age and the name of the 1st person who has it

5.- Determine and show the oldest age and the name of the 1st person who has it

The condition is that it does not use an array, but that everything is with several threads using a cycle while

``````Algoritmo MayorMenor
FinAlgoritmo
i=1
cont=0
Mientras i<=3
Mostrar "Ingrese el nombre de la ",i "°persona: " Sin Saltar
Leer nombre
Mostrar "Ingrese la edad de la ",i "°persona: " Sin Saltar
i=i+1
FinMientras
FinSubProceso

prom=acum/3
FinSubProceso
``````

asked by Luis Troya 06.10.2018 в 03:46
source

0

First of all you must understand the difference between step by value and step by reference.

If the value of a variable you plan to change later, use the step by reference, if you do not use step by value.

I'm using the profile `FCA-UNAM` which is a bit more strict than the one you have, so I hope it will help you to become clearer in pseudo.

The accumulated age will be used for subsequent calculations, so we pass that value by reference when reading it, so when leaving the subprocess we will not lose that value.

The names as you will see are irrelevant in the other steps, so we reduce their scope so that the names live only in the sub-process input and leaving that sub-process are deleted.

``````Algoritmo MayorMenor
definir acum Como Entero;
acum=0;
FinAlgoritmo

Definir i como Entero;
i=1;
Mientras i<=3
Mostrar "Ingrese el nombre de la ",i "°persona: " Sin Saltar;
Leer nombre;
Mostrar "Ingrese la edad de la ",i "°persona: " Sin Saltar;
i=i+1;
FinMientras
FinSubProceso