# Convert Days to Years, Weeks, and Days in C

Apr 17, 2022
Machine Problem

Write a program to ask the user to give an input number of days and convert it to years, weeks, and days and display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My mobile number here in the Philippines is 09173084360.

=================================================

Want to support my channel?

GCash Account

09173084360

Paypal

Patreon

Thank you very much for your support

Program Listing

/* days.c
Convert days to years weeks and days
Author   : Jake Rodriguez Pomperada, MAED-IT, MIT
Tool     : Dev C++ Version 5.11
Date     : April 18, 2022  5:51 AM  Monday
*/

#include <stdio.h>

int main()
{
int days=0, years=0, weeks=0;

system("COLOR F0");
printf("\n\n");
printf("\tConvert Days to Years, Weeks and Days in C");
printf("\n\n");
printf("\tHow Many Days : ");
scanf("%d", &days);

/* Conversion in this portion */
years = (days / 365);   /* Ignoring leap year */
weeks = (days % 365) / 7;
days  = days - ((years * 365) + (weeks * 7));

printf("\n\n");
printf("\tDisplay Results");
printf("\n\n");
printf("\tNumber of Years : %d\n", years);
printf("\tNumber of Weeks : %d\n", weeks);
printf("\tNumber of Days  : %d", days);
printf("\n\n\n");
printf("\tEND OF PROGRAM");
printf("\n\n");
}