-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
38 lines (28 loc) · 824 Bytes
/
Main.java
File metadata and controls
38 lines (28 loc) · 824 Bytes
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
38
package beecrowd1020;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int idade = sc.nextInt();
sc.close();
int ANOEMDIAS = 365;
int MESEMDIAS = 30;
int ano = 0;
int mes = 0;
int dia = 0;
if (idade >= ANOEMDIAS) {
ano = idade / ANOEMDIAS;
idade = idade % ANOEMDIAS;
} else {
ano = 0;
}
if(idade >= MESEMDIAS){
mes = idade / MESEMDIAS;
idade = idade % MESEMDIAS;
}
if(idade <= MESEMDIAS){
dia = idade;
}
System.out.printf("%d ano(s)%n%d mes(es)%n%d dia(s)%n", ano, mes, dia);
}
}