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

C Program to Convert Entered Number of Days into Years, Months and Days, Write a program to convert entered number of days into years, months and days.

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=%d\nMonth=%d\nDay=%d",year,month,day);
        getch();
}

Output

Convert days into years

You May Also Like...

Socialize with Us