Last active
September 2, 2016 02:59
-
-
Save ofou/f6384b1fbc719981f17890e5fbe26495 to your computer and use it in GitHub Desktop.
Print multiples of a given positive number and error message if negative
This file contains 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){ | |
System.out.println("Error. Ingrese un numero positivo"); | |
} | |
else{ | |
for(int contador=1 ; contador<numeroUsuario; contador++ ){ | |
if(numeroUsuario%contador == 0){ | |
System.out.println(contador); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment