C Program to convert days to years weeks and days

Hello coders, in this post we will how to write C Program to convert days to years weeks and days. This is a very basic C program.

As you already know that this site does not contain only c programming solutions here, you can also find the solution for other problems. I.e. Web Technology, Data StructuresRDBMS ProgramsJava Programs Solutions,  Fiverr Skills Test answersGoogle Course AnswersLinkedin AssessmentLeetcode Solutions, and Coursera Quiz Answers.

C Program to convert days to years weeks and days
C Program to convert days to years weeks and days

if you want to learn C programming free of cost please visit:

C Program to convert days to years weeks and days

#include <stdio.h> 
int main()
{
    int days, years, weeks;

    days = 1329; 

    // Converts days to years, weeks and days
    years = days/365; 
    weeks = (days % 365)/7;
    days = days- ((years*365) + (weeks*7));

    printf("Years: %d\n", years);
    printf("Weeks: %d\n", weeks);
    printf("Days: %d \n", days);

    return 0;
}

Output

Years: 3
Weeks: 33
Days: 3

Conclusion

I hope after going through this post, you understand how to write a C Program to convert days to years weeks and days, if there is any case program is not working and showing an error please let me know in the comment section.

Sharing Is Caring

Leave a Comment