ASSIGNMENT - 3 Years, Weeks & Days
Years, Weeks & Days
Given
N
number of days as input, write a program to convert N
number of days to years (Y
), weeks (W
) and days (D
).Note:
Take 1 year = 365 days. Input
The input contains single integer
N
.Output
Print in each new line
Y
, W
and D
.Explanation
Given
N = 1329
. The value can be written as 1329 = 3 years + 33 weeks + 3 days
So the output should be
Sample Input 1Sample Output 1
1329
3 33 3
Sample Input 2Sample Output 2
0
0 0 0
n=int(input())
y=int(n/365)
rd=n-(y)*365
w=int(rd/7)
d=rd-(w)*7
print(y)
print(w)
print(d)
Comments
Post a Comment