My favorites
▼
|
Sign in
lineadecodigo
Web Code Samples in spanish
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
lineadecodigo_java
/
src
/
com
/
lineadecodigo
/
java
/
basico
/
DivisiblePor.java
r478
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.lineadecodigo.java.basico;
/**
* @file DivisiblePor.java
* @version 1.0
* @author Linea de Codigo (http://lineadecodigo.com)
* @date 28.julio.09
* @url http://lineadecodigo.com/java/numeros-divisibles-con-java/
* @description Como calcular si un número es divisible por otro.
*/
import java.util.Scanner;
public class DivisiblePor {
public static void main(String[] args) {
// Pedimos los número por teclado
Scanner reader = new Scanner(System.in);
int numero1,numero2;
System.out.println("Introduce un número");
numero1 = reader.nextInt();
System.out.println("Introduce el número por el cual quieres saber si es divisible");
numero2 = reader.nextInt();
//Conprobamos si uno es divisible por otro
if (numero1%numero2 == 0)
System.out.println(numero1 + " es divisible por " + numero2);
else
System.out.println(numero1 + " NO es divisible por " + numero2);
}
}
Show details
Hide details
Change log
r148
by vcuervo on Jul 28, 2009
Diff
Divisible por en Java
Go to:
...go/java/basico/DivisiblePor.java
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 971 bytes, 37 lines
View raw file
Powered by
Google Project Hosting