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
| import java.util.Scanner; | |
| /** | |
| * Created by @ofrancisco on 9/1/16. | |
| */ | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner lector = new Scanner(System.in); | |
| int numeroUsuario = lector.nextInt(); | |
| if(numeroUsuario<0){ |
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
| public class ParImpar{ | |
| int numeroUsuario; | |
| public int cuenta(int numeroUsuario){ | |
| int contador = 0; | |
| int suma = 0; | |
| if (numeroUsuario<0){ | |
| //suma negativos | |
| while(contador!=numeroUsuario-1){ | |
| if(contador % 2 == 0){ | |
| contador = contador - 1; |
NewerOlder