C program to convert given number of days into years, weeks and days

In this C program you will know how to convert given number of days into years, weeks and days.

For example:

If user enter 1234 days then.
Years = 3
Weeks = 21
Days = 1
 
Comment below if you are facing any problem to understand the logic of this program.

 

Output
C program to convert given number of days into years,weeks and days

 

" data-link="https://twitter.com/intent/tweet?text=C+program+to+convert+given+number+of+days+into+years%2C+weeks+and+days&url=https%3A%2F%2Fwww.thecrazyprogrammer.com%2F2012%2F04%2Fc-program-to-convert-given-number-of.html&via=">">Tweet
1 Shares

7 thoughts on “C program to convert given number of days into years, weeks and days

  1. Ruturaj Pansare

    Dear Sir,Your program is completely inappropriate.When we enter days=1234,years should be 3,weeks should be 176[logic =176*7=1232] instead it is showing 21.Simply illogical.
    I recommend a simple program to find no of weeks
    i.e days/7;

    Reply
    1. Admin Post author

      The program is working absolutely fine. Just go and check the logic again.

      Reply
      1. sameer

        logic is absolutely fine but the output in your example may be wrong.
        I think
        Enter a number
        1234
        years = 3
        weeks = 19
        days = 6
        Process returned 0 (0x0) execution time : 2.131 s

        Reply
  2. sokleng heang

    I wanna know how to convert days to year, month, days by using structure.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.