Problem printing psint arrays

1

I do not know if it is possible to do it this way, but when finally the program is going to print the matrices the name is printed twice with both ages that I have put

Dimension nombre[1, 2]
Dimension edad[1, 2]
Para i<-1 Hasta 1 Con Paso 1 Hacer
    Para m<-1 Hasta 2 Con Paso 1 Hacer
        Escribir "Escriba el nombre de la persona que se guardara en la celda ", i, ".", m
        Leer nombre[i, m]
    Fin Para
Fin Para

Para s<-1 Hasta 1 Con Paso 1 Hacer
    Para t<-1 Hasta 2 Con Paso 1 Hacer
        Escribir "Escriba la edad de la persona que se guardara en la celda ", s, ".", t
        Leer edad[s, t]
    Fin Para
Fin Para

Para i<-1 Hasta 1 Con Paso 1 Hacer
    Para m<-1 Hasta 2 Con Paso 1 Hacer
        Para s<-1 Hasta 1 Con Paso 1 Hacer
            Para t<-1 Hasta 2 Con Paso 1 Hacer
                Escribir nombre[i, m], " tiene una edad de ", edad[s, t]
            Fin Para
        Fin Para
    Fin Para
Fin Para

FinAlgoritmo

    
asked by Spidyoverflow 24.07.2018 в 16:28
source

1 answer

0

try this ...

Para s<-1 Hasta 1 Con Paso 1 Hacer 
  Para t<-1 Hasta 2 Con Paso 1 Hacer 
   Escribir nombre[s, t], " tiene una edad de ", edad[s, t] 
  Fin Para Fin Para
Fin Para Fin Para

what happens is that the letters are part only of the iterators, in which their function the only thing you do is to traverse the matrices, therefore the two matrices have the same dimensions, then only two cycles are necessary, it is more With two cycles you could fill the matrices, I'm glad you served.

    
answered by 24.07.2018 в 18:04