Created
December 5, 2012 09:16
-
-
Save lauralaurilauro/4214159 to your computer and use it in GitHub Desktop.
sumar n numeros pares
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var n=12; | |
var resultado=0; | |
function check (n){ | |
if (n%2 ==0){ | |
i=0;i<=20;i++; | |
resultado= resultado+i; | |
console.log(resultado); | |
} | |
else{ | |
console.log("es impar"); | |
} | |
} | |
Opcion 2 | |
var n= 10; | |
var resultado= 0; | |
for (i=0;i<=n;i+2) { | |
if (n%2==0) | |
resultado=resultado+1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment