To Convert given days to years,week and days in c program
#include<stdio.h>
main()
{
int nodays,years,weeks,days;
printf("Enter the total days\n");
scanf("%d",&nodays);
years=nodays/365;
weeks=(nodays%365)/7;
days=(nodays%365)%7;
printf("%d = %d years,%d weeks,%d
days\n",nodays,years,weeks,days);
}
Output:-
Enter the total days
500
500 = 1 years,19 weeks,2 days
Post a Comment
If you have any doubts, Please let me know
Thanks!