Example Of Days In terms Of Years, Weeks and Days:
Input : 30 Output : years = 0 week = 4 days = 2 Input : 20 Output : years = 0 week = 2 days = 6
How to solve this Problem?
Step-1: Number of years will be the quotient when a number of days will be divided by 365 i.e days / 365 = years.
Step-2: Number of weeks will be the result of (Number_of_days % 365) / 7.
Step-3: Number of days will be the result of (Number_of_days % 365) % 7.
Below is the program implementing above approach:
years = 0 weeks = 28 days = 4
Please share and comment on this post and wants to improve WhatsApp us.