C Program to Convert Entered Number of Days into Years, Months and Days

0
2
digitalample eye
Write a program to 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();
}

Output

Convert days into years

LEAVE A REPLY

Please enter your comment!
Please enter your name here