Write a C program that accepts an input in integer representing the total number of days
and outputs the equivalent values in years, months and days.
main()
{
int days,months,years,n;
printf("\n\tEnter no. of days: "); scanf("%d",n);
years = n/365;
months= (n%365)/30;
days = (n%365)%30;;
printf("\n\tYears = %d",years);
printf("\n\tMonths = %d",months);
printf("\n\tDays = %d",days);
}
Comments
Leave a comment