-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEjercicio-9.js
33 lines (23 loc) · 861 Bytes
/
Ejercicio-9.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
Escribir un programa que lea una lista de números y determine cuales son positivos, y cuales son negativos.
*/
const listaNumeros = [-1, 1, -2, 2, 3, -3, 4, -4, -5, -6, 5, 6]
// N P N P P N P N N N P P
const positivoNegativo = (a) => {
a > 0 ? console.log("Su numero es positivo") : a < 0 ? console.log("Su numero es negativo") : a === 0 ? console.log("Su numero es 0") : console.log("Ingrese un numero valido")
}
listaNumeros.forEach(positivoNegativo)
/*
Funcion normal
// const positivoNegativo = (a) => {
// if (a > 0) {
// console.log("Su numero es positivo")
// } else if (a < 0) {
// console.log("Su numero es negativo");
// } else if (a === 0) {
// console.log("Su numero es 0");
// } else {
// console.log("Ingrese un numero valido");
// }
// }
*/