C Program to Convert Days Into Years, Weeks and Days

Here I have shared the C program to convert given number of days into years, weeks and days.

For Example, if the user has entered 365 days (not a leap year) then the output will be:

Years: 1
Weeks: 0
Days: 0



#include<stdio.h>
int main()
{
 int y,d,w;
 
 printf("Enter No. of days:");
 scanf("%d",&d);
 
 y=d/365;
 d=d%365;
 w=d/7;
 d=d%7;
 
    printf("\nYears:%d \nWeeks:%d \nDays:%d,",y,w,d);
 return 0;
}

NOTE: You have any problem in above C Program do not hesitate and write your problem in the comment box. I will support your problem.

If you have any doubts, Please let me know

Previous Post Next Post

Contact Form