Convert days to years, months, and days with C language
#include <stdio.h>
#include <conio.h>
int main()
{
int n,y,m,d;
printf("\nEnter Number : ");
scanf("%d", &n);
y= n/365;
m= (n%365)/30;
d = (n % 365) % 30;
printf(" Years : %d\n Months : %d\n days : %d\n",y,m,d);
return (0);
}
Output:-
Enter Number : 4570
Years : 12
Months : 6
days : 10
0 Comments