forked from kant003/HolaMundoHacktoberfest2017
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJava2
34 lines (27 loc) · 699 Bytes
/
Java2
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
import java.util.Scanner;
public class Ejercicio6Alternativo
{
public static void main(String[] args)
{
Scanner lector = new Scanner(System.in);
int d, m, a;
int n;
// INTRODUCIMOS LOS DATOS
System.out.println("Introduce tu d�a de nacimiento:");
d = lector.nextInt();
System.out.println("Introduce tu mes de nacimiento:");
m = lector.nextInt();
System.out.println("Introduce tu a�o de nacimiento:");
a = lector.nextInt();
n = d + m + a;
do
{
n = (n / 1000) +
((n % 1000) / 100) +
(((n % 1000) % 100) / 10) +
(((n % 1000) % 100) % 10);
} while (n >= 10);
System.out.println("Tu n�mero de la suerte es: " + n);
lector.close();
}
}