Write a program to convert days into years months and days in c.
#include<stdio.h>
#include<conio.h>
void main()
{
int nodays,days,years,months;
clrscr();
printf("Enter the total days: ");
scanf("%d",&days);
nodays=days;
years=days/365;
days=days%365;
months=days/30;
days=days%30;
printf("%d days= %d years-%d months-%d days",nodays,years,months,days);
getch();
}
Output:
Enter the total days: 1000
1000 days= 2 years-9 months-0 days
No comments: