ALGORITMO QUE LISTA NÚMEROS POSITIVOS, NEGATIVOS Y NULOS

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


Algoritmo que muestra los números positivos, negativos y nulos

Mostrar los números positivos, negativos y neutros del array en PSeInt

💻 Hacer un programa que permita ingresar 10 valores a un array y muestre cuantos son positivos, negativos y nulos.


Algoritmo en pseint que muestre los números positivos, negativos y nulos de un vector PSeInt Estricto :

Algoritmo programacion_work
    Definir vector, positivo, negativo, nulo, f como Entero;
    Dimension vector[10];
    positivo  <- 0;
    negativo  <- 0;
    nulo  <- 0;
    Escribir "06. MUESTRA POSITIVOS, NEGATIVOS Y NULOS.";
    //Ingresa 10 valores al array
    Para f  <- 0 hasta 9 con paso 1 hacer         
        Escribir Sin Saltar "Ingrese Número ", f + 1, " : ";
        Leer vector[f];
    FinPara      
    //Muestra Positivos, Negativos, Nulos
    Para f  <- 0 hasta 9 con paso 1 hacer                  
        Si vector[f] = 0 Entonces
            nulo  <- nulo + 1;
        SiNo
            Si vector[f] > 0 Entonces
                positivo  <- positivo + 1;
            SiNo
                negativo  <- negativo + 1;
            FinSi
        FinSi
    FinPara
    Escribir "Total de Nulos : ", nulo;
    Escribir "Total de Positivos : ", positivo;
    Escribir "Total de Negativos : ", negativo;
FinAlgoritmo

código en python para mostrar los valores positivos, negativos y nulos que hay en un vector Python :

vector = [int() for ind0 in range(10)]
positivo = 0
negativo = 0
nulo = 0
# Ingresa 10 valores al array
for f in range(10):
    print("Ingrese Número ",f+1," : ", end="")
    vector[f] = int(input())
# Muestra Positivos, Negativos, Nulos
for f in range(10):
    if vector[f]==0:
        nulo = nulo+1
    else:
        if vector[f]>0:
            positivo = positivo+1
        else:
            negativo = negativo+1
print("Total de Nulos : ",nulo)
print("Total de Positivos : ",positivo)
print("Total de Negativos : ",negativo)

código en Dev C++ de números positivos, negativos y nulos que tiene un vector LENGUAJE C:

#include<stdio.h>
int main() {
    int negativo=0, nulo=0, positivo=0, vector[10];
    /* Ingresa 10 valores al array */
    for (int f=0;f<=9;f+=1) {
        printf("Ingrese Numero %d : ",f+1);
        scanf("%i",&vector[f]);
    }
    /* Muestra Positivos, Negativos, Nulos */
    for (int f=0;f<=9;f+=1) {
        if (vector[f]==0) {
            nulo = nulo+1;
        } else {
            if (vector[f]>0) {
                positivo = positivo+1;
            } else {
                negativo = negativo+1;
            }
        }
    }
    printf("\nTotal de Nulos     : %d\n",nulo);
    printf("Total de Positivos : %d\n",positivo);
    printf("Total de Negativos : %d\n",negativo);
    return 0;
}

código en Dev C++ que muestra los números positivos, negativos y nulos que tiene un array Dev C++ :

#include<iostream>
using namespace std;
int main() {
    int negativo=0, nulo=0, positivo=0, vector[10];
    // Ingresa 10 valores al array
    for (int f=0;f<=9;f+=1) {
        cout << "Ingrese Numero " << f+1 << " : ";
        cin >> vector[f];
    }
    // Muestra Positivos, Negativos, Nulos
    for (int f=0;f<=9;f+=1) {
        if (vector[f]==0) {
            nulo = nulo+1;
        } else {
            if (vector[f]>0) {
                positivo = positivo+1;
            } else {
                negativo = negativo+1;
            }
        }
    }
    cout << "\nTotal de Nulos     : " << nulo << endl;
    cout << "Total de Positivos : " << positivo << endl;
    cout << "Total de Negativos : " << negativo << 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