Ticker

6/recent/ticker-posts

Convert no of days into years, weeks and days Program





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

Post a Comment

0 Comments