Question #266731

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.

Expert's answer

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);
}

LATEST TUTORIALS
APPROVED BY CLIENTS