Write a C program to convert Total days to year, month and days. Here’s simple program to convert Total days to year, month and days in C Programming Language.
Below is the source code for C program to convert Total days to years, month and days which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
/* C program to convert Total days to year, month and days */
#include <stdio.h>
int main(void)
{
int d,y,m,nd;
printf("Enter number of days :: ");
scanf("%d",&d);
y=d/365;
d=d%365;
m=d/30;
nd=d%30;
printf("\n%d years, %d months, %d days\n",y,m,nd);
return 0;
}
OUTPUT : :
Enter number of days :: 560
1 years, 6 months, 15 days
Above is the source code for program to convert Total days to year, month and days which is successfully compiled and run on Windows System.The Output of the program is shown above .
Below is the source code for C program to convert Total days to years, month and days which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
OUTPUT : :
Above is the source code for program to convert Total days to year, month and days which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer