-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgeInDays.java
More file actions
35 lines (34 loc) · 776 Bytes
/
AgeInDays.java
File metadata and controls
35 lines (34 loc) · 776 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
import java.util.*;
public class AgeInDays {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long y = 0;
long m = 0;
long d = 0;
// long rd = 0;
if (n>=365) {
y = n/365;
d = n%365;
// rd = n%365;
}
else{
d = n;
// rd = n;
}
// if (rd>=30) {
if (d>=30) {
m = d/30;
d = d%30;
// m = rd/30;
// d = rd%30;
}
// else{
// d = rd;
// }
System.out.println(y+" years");
System.out.println(m+" months");
System.out.println(d+" days");
sc.close();
}
}