#include<stdio.h>
int main()
{
int days, years, weeks;
scanf("%d", &days);
years = (days / 365); // Ignoring leap year
weeks = (days % 365) / 7;
days = days - ((years * 365) + (weeks * 7));
printf("YEARS: %d\n", years);
printf("WEEKS: %d\n", weeks);
printf("DAYS: %d", days);
return 0;
}
Input
500
Output:
YEARS: 1
WEEKS: 19
DAYS: 2
int main()
{
int days, years, weeks;
scanf("%d", &days);
years = (days / 365); // Ignoring leap year
weeks = (days % 365) / 7;
days = days - ((years * 365) + (weeks * 7));
printf("YEARS: %d\n", years);
printf("WEEKS: %d\n", weeks);
printf("DAYS: %d", days);
return 0;
}
Input
500
Output:
YEARS: 1
WEEKS: 19
DAYS: 2
No comments:
Post a Comment