How do I make a 3 x 3 matrix in pseint in which the user enters the numbers?

2

I need to build an algorithm that traverses a 3 x 3 matrix I must fill this matrix before, print all the numbers that are under a value entered by the user.

Algoritmo  Arreglo
  Dimension A[3,3];
  Definir A Como Entero;
  Definir i Como Entero;
  Definir j como entero;

  Para i<-0 Hasta 2 Con Paso 1 Hacer
    Escribir "De un numero";
    Leer A[i,j];
  FinPara

  Para i<-0 Hasta 2 Con Paso 1 Hacer
    Escribir Sin Saltar A[i,j];       
  FinPara

FinAlgoritmo
    
asked by Sebastian Ortiz 18.06.2017 в 09:00
source

2 answers

1

Under the assumption that you have set PseInt to use array indexes from scratch (0) you should do something like this:

Algoritmo  Arreglo
    Dimension A[3,3];
    Definir A Como Entero;
    Definir i Como Entero;
    Definir j como entero;

    Para i<-0 Hasta 2 Con Paso 1 Hacer
        Para j<-0 Hasta 2 Con Paso 1 Hacer
            Escribir "De un numero";
            Leer A[i,j];
        Fin Para
    FinPara

    Para i<-0 Hasta 0 Con Paso 1 Hacer            
        Escribir ""; //Esto es solo para dar un poco de formato
        Para j<-0 Hasta 2 Con Paso 1 Hacer
            Escribir Sin Saltar A[i,j] " ";
        Fin Para        
    FinPara     
FinAlgoritmo

Sample in operation:

    
answered by 19.06.2017 в 09:10
0

The solution example had some errors. For i<-0 Hasta 0 Con Paso 1 Hacer is not running any loop, just assign the value 0 to the variable i, there was the error.

Proceso Arreglo
    Dimension A[3,3];
    Definir A, i, j Como Entero;

    Para i<-0 Hasta 2 Con Paso 1 Hacer
        Para j<-0 Hasta 2 Con Paso 1 Hacer
            Escribir "De un numero";
            Leer A[i,j];
        FinPara
    FinPara

    Escribir "La matriz ingresada es ";
    Para i<-0 Hasta 2 Con Paso 1 Hacer            
        Escribir ""; //Esto es solo para dar un poco de formato
        Para j<-0 Hasta 2 Con Paso 1 Hacer
            Escribir Sin Saltar A[i,j], " ";
        FinPara        
    FinPara
    Escribir "";
FinProceso
    
answered by 18.09.2017 в 17:59