Wednesday, 20 August 2014

Filled Under:

C program to convert days into year month and day

Share

C program to convert days into year month and day,that means the number of days entered by user will be converted into a measure of time given in years, weeks and days. For example 375 days is equal to 1 year 1 week and 3 days (ignore leap year).This program help when you have only number of days and you want to convert these days into year month and day for some important purpose.

C program to convert days into year month and day

#include<stdio.h>
#idefine DAYSINWEEK 7
void main()
{
  int  ndays,year,week,days;
  year=ndays/365;
  week=(ndays%365)/DAYSINWEEK;
  days=(ndays%365)%DAYSINWEEK;
  printf("%d is equivalent to %d years,%d week and %d daysn",ndays,year,week,days);
}

Output