Question: Write a program, called problem 5 . c , that asks the user for a number of days ( whole days, not fractional days )

Write a program, called problem5.c, that asks the user for a number of days (whole days, not fractional days) and calculates the number of years, weeks, and days that corresponds to. You can ignore leap years, so assume we always have 365 days in year.
For example, 368 days would correspond to 1 year, 0 weeks, and 3 days, because 1 year +3 days is 368 days.
(1*365)+(0*7)+3=368
As another example, 1230 days would correspond to 3 years, 19 weeks, and 2 days, because 3 years +19 weeks +2 days is 1230 days.
(3*365)+(19*7)+2=1230
Take the 1230 days example above. Think about how you can take advantage of using the appropriate type of division to get a quotient and remainder. For example, if you divide 1230 by 365, the quotient is 3, and the remainder is 135. The 3 gives us the number of years. How can we use the 135 to calculate the rest of the values?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!