ALGORITMO QUE CALCULE EL PROMEDIO DE 3 VECTORES

Vector - Array - Vector Unidimensional [1 Columna, n Filas].


Algoritmo que promedie tres vectores

Código que promedia 3 vectores en PSeInt

💻 Sumar tres vectores y mostrar el promedio en un cuarto vector.

promedio de vectores

Algoritmo en pseint para calcular el promedio de 3 vectores PSeInt Estricto :

Algoritmo programacion_work
    Definir n1, n2, n3, pro, f como Entero;
    Dimension n1[8];
    Dimension n2[8];
    Dimension n3[8];
    Dimension pro[8];
    Escribir "08. PROMEDIO DE 3 VECTORES.";
    //Ingresa 8 notas al array n1, n2 y n3
    Para f <- 0 hasta 7 con paso 1 hacer         
        Escribir "INGRESE 3 NOTAS : ", f + 1;
        Escribir Sin Saltar "Ingrese Nota 1: ";
        Leer n1[f];
        Escribir Sin Saltar "Ingrese Nota 2: ";
        Leer n2[f];
        Escribir Sin Saltar "Ingrese Nota 3: ";
        Leer n3[f];
        Escribir "";
    FinPara      
    //Muestra y Calcula los tres promedios
    Para f <- 0 hasta 7 con paso 1 hacer                  
        Escribir "(",n1[f],"+",n2[f],"+",n3[f],")/3 = ",(n1[f]+n2[f]+n3[f])/3;
    FinPara   
FinAlgoritmo

código en python para mostrar el promedio de tres vectores Python :

n1 = [int() for ind0 in range(8)]
n2 = [int() for ind0 in range(8)]
n3 = [int() for ind0 in range(8)]
pro = [int() for ind0 in range(8)]
# Ingresa 8 notas al array n1, n2 y n3
for f in range(8):
    print("INGRESE 3 NOTAS : ",f+1)
    n1[f] = int(input("Ingrese Nota 1: "))
    n2[f] = int(input("Ingrese Nota 2: "))
    n3[f] = int(input("Ingrese Nota 3: "))
    print()
# Muestra y Calcula los tres promedios
for f in range(8):
    print("(",n1[f],"+",n2[f],"+",n3[f],")/3 = ",(n1[f]+n2[f]+n3[f])/3)

código en Dev C++ que promedie tres arrays LENGUAJE C:

#include<stdio.h>
int main() {
    int n1[8], n2[8], n3[8], pro[8];
    /* Ingresa 8 notas al array n1, n2 y n3 */
    for (int f=0;f<=7;f++) {
        printf("\nINGRESE 3 NOTAS : %d\n",f+1);
        printf("Ingrese Nota 1: ");
        scanf("%i",&n1[f]);
        printf("Ingrese Nota 2: ");
        scanf("%i",&n2[f]);
        printf("Ingrese Nota 3: ");
        scanf("%i",&n3[f]);
        printf("\n");
    }
    /* Muestra y Calcula los tres promedios */
    for (int f=0;f<=7;f++) {
        printf("( %d+%d+%d )/3 = %d\n",n1[f],n2[f],n3[f],(n1[f]+n2[f]+n3[f])/3);
    }
    return 0;
}

código en Dev C++ que muestre el promedio de 3 arrays Dev C++ :

#include<iostream>
using namespace std;
int main() {    
    int n1[8], n2[8], n3[8], pro[8];
    // Ingresa 8 notas al array n1, n2 y n3
    for (int f=0;f<=7;f++) {
        cout << "\nINGRESE 3 NOTAS : " << f+1 << endl;
        cout << "Ingrese Nota 1: ";
        cin >> n1[f];
        cout << "Ingrese Nota 2: ";
        cin >> n2[f];
        cout << "Ingrese Nota 3: ";
        cin >> n3[f];
        cout << endl;
    }
    // Muestra y Calcula los tres promedios
    cout << endl;
    for (int f=0;f<=7;f++) {
        cout << "("<< n1[f] <<"+"<< n2[f] <<"+"<< n3[f] <<")/3 = "<< (n1[f]+n2[f]+n3[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