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.
The input contains single integer
Print space-separated integers
Given
N = 1329. The value can be written as 1329 = 3 years + 33 weeks + 3 daysSo the output should be
3
33
3
N=0
0
0
0
N = int(input("Enter number of days: "))
Y = N // 365
if Y > 0:
print(Y, "Years", end = " ")
W = (N - Y * 365) // 7
if W > 0:
print(W, "Weeks", end = " ")
D = N - Y * 365 - W * 7
if D > 0:
print(D, "days")
else:
print("")
Comments
Leave a comment