Answer to Question #266731 in C for Gladys

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.

1
Expert's answer
2021-11-16T05:21:44-0500
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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS