![Algoritmo que muestra los números positivos, negativos y nulos](https://programacion.work/vectores/img/positivos-negativos-nulos-en-pseint.png)
Vector - Array - Vector Unidimensional [1 Columna, n Filas].
💻 Hacer un programa que permita ingresar 10 valores a un array y muestre cuantos son positivos, negativos y nulos.
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
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)
#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;
}
#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;
}