ALGORITMO QUE GRÁFICA UNA MATRIZ NUMÉRICA DE NÚMEROS

Matriz - Matrices - Vector Bidimensional


Algoritmo que ingrese datos en una matriz

Completa fila de números en una matriz en PSeInt

💻 Elaborar un programa que llene una matriz de 4 × 4 con unos y dos de siguiente manera:

registra números de una matriz

Algoritmo en pseint para registrar números en una matriz PSeInt Estricto :

Algoritmo programacion_work
    Definir matrix, f, c como Entero;
    Dimension matrix[4,4];
    Escribir "08. MATRIZ DE 4 x 4.";
    //Cargar Array Bidimencional
    Para f <- 0 hasta 3 con paso 1 hacer
        Para c <- 0 hasta 3 con paso 1 hacer
            matrix[f,c] <- f;
            Segun f Hacer
                0: matrix[f,c] <- 1;
                1: matrix[f,c] <- 2;
                2: matrix[f,c] <- 2;
                3: matrix[f,c] <- 1;
            FinSegun
        FinPara         
    FinPara
    //Mostrar Array Bidimencional
    Para f <- 0 hasta 3 con paso 1 hacer
        Escribir matrix[f,0]," ",matrix[f,1]," ",matrix[f,2]," ",matrix[f,3];
    FinPara      
FinAlgoritmo

código en python que registra números Python :

matrix = [[int() for ind0 in range(4)] for ind1 in range(4)]
# Cargar Array Bidimencional
for f in range(4):
    for c in range(4):
        matrix[f][c] = f
        if f==0:
            matrix[f][c] = 1
        elif f==1:
            matrix[f][c] = 2
        elif f==2:
            matrix[f][c] = 2
        elif f==3:
            matrix[f][c] = 1
# Mostrar Array Bidimencional
for f in range(4):
    print(matrix[f][0]," ",matrix[f][1]," ",matrix[f][2]," ",matrix[f][3])

código en Lenguaje C que ingresa números en secuencia de una matriz de 4 x 4 Lenguaje C :

/* ----------------- */
/* | 1 | 1 | 1 | 1 | */
/* | 2 | 2 | 2 | 2 | */
/* | 2 | 2 | 2 | 2 | */
/* | 1 | 1 | 1 | 1 | */
/* ----------------- */
#include<stdio.h>
int main() {
    int c, f;
    int matrix[4][4];
    /* Cargar Array Bidimencional */
    for (f=0;f<=3;f+=1) {
        for (c=0;c<=3;c+=1) {
            matrix[f][c] = f;
            switch (f) {
            case 0:
                matrix[f][c] = 1;
                break;
            case 1:
                matrix[f][c] = 2;
                break;
            case 2:
                matrix[f][c] = 2;
                break;
            case 3:
                matrix[f][c] = 1;
                break;
            }
        }
    }
    /* Mostrar Array Bidimencional */
    for (f=0;f<=3;f+=1) {
        printf("%d %d %d %d\n",matrix[f][0],matrix[f][1],matrix[f][2],matrix[f][3]);
    }
    return 0;
}

código en Dev C++ que registra valores en un vector de 4 x 4 Dev C++ :

// -----------------
// | 1 | 1 | 1 | 1 |
// | 2 | 2 | 2 | 2 |
// | 2 | 2 | 2 | 2 |
// | 1 | 1 | 1 | 1 |
// -----------------
#include<iostream>
using namespace std;
int main() {
    int c, f;
    int matrix[4][4];
    // Cargar Array Bidimencional
    for (f=0;f<=3;f++) {
        for (c=0;c<=3;c++) {
            matrix[f][c] = f;
            switch (f) {
            case 0:
                matrix[f][c] = 1;
                break;
            case 1:
                matrix[f][c] = 2;
                break;
            case 2:
                matrix[f][c] = 2;
                break;
            case 3:
                matrix[f][c] = 1;
                break;
            }
        }
    }
    // Mostrar Array Bidimencional
    for (f=0;f<=3;f++) {
        cout << matrix[f][0] << " " << matrix[f][1] << " " << matrix[f][2] << " " << matrix[f][3] << endl;
    }
    return 0;
}



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