Program -
#include <stdio.h>
int main()
{ int Days,year,day,month,remainingweek,remainingmonth,week;
printf("Enter the no. of days ");
scanf("%d",&Days);
year=Days/365, remainingmonth=Days%365, month=remainingmonth/30, remainingweek=remainingmonth%30, week=remainingweek/7, day=remainingweek%7;
printf("%d years %d months %d weeks %d days",year,month,week,day);
return 0;
}
Output -
Enter the no. of days 400
1 years 1 months 0 weeks 5 days
0 Comments