Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 7, 2014 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/ae80f87a8e227fb92766 to your computer and use it in GitHub Desktop.
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.
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