Programming

C – Convert Entered Number of Days into Years, Months and Days

C – Convert Entered Number of Days into Years, Months, and Days

C Code

#include <stdio.h>
#include <conio.h>
void main()
{
int d,year,month,day,remd;
clrscr();
printf("Enter the number of days to convert:");
scanf("%d",&d);
year=d/365;
remd=d%365;
month=remd/30;
day=remd%30;
printf("Year=%dnMonth=%dnDay=%d",year,month,day);
getch();
}

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.