Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package AceptaElReto;
- import java.util.Scanner;
- /**
- *
- * @author mcpcm
- */
- public class Reto165 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int contador;
- boolean negativo = false;
- while(negativo == false){
- String argumento = sc.nextLine();
- char numeros[] = argumento.toCharArray();
- contador = 0;
- if(numeros[0]!= '-'){
- for (int i = 0; i < numeros.length; i++) {
- if (numeros[i] % 2 == 0) {
- contador++;
- } else {
- contador = numeros.length+1;
- }
- }
- if (contador == numeros.length) {
- System.out.println("SI");
- } else if (contador > numeros.length){
- System.out.println("NO");
- }
- } else{
- negativo = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement