Created
July 7, 2014 15:03
-
-
Save Fhernd/ae80f87a8e227fb92766 to your computer and use it in GitHub Desktop.
Programa que determina si un número entero es múltiplo de otro.
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; | |
// Declaración de clase | |
public class Multiplo | |
{ | |
// El método 'main' inicia la ejecución de la aplición en Java | |
public static void main( String[] args ) | |
{ | |
// Variables | |
int numero1; | |
int numero2; | |
// Instanciación de un objeto de clase 'Scanner' | |
Scanner entrada = new Scanner( System.in ); | |
// Solicitud y obtención de los datos | |
System.out.print( "Digite el primer entero: " ); | |
numero1 = entrada.nextInt(); | |
System.out.print( "Digite el segundo entero: " ); | |
numero2 = entrada.nextInt(); | |
// Determinar si el primer entero es múltiplo del segundo entero | |
if( numero1 % numero2 == 0 ) | |
{ | |
System.out.printf( "\n%d es múltiplo de %d.", numero1, numero2 ); | |
} | |
System.exit(0); | |
} // Fin del método 'main' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment