Q-7.Write a C program to input number of days from user and convert it to years, weeks and days. How to convert days to years, weeks in C programming. Logic to convert days to years, weeks and days in C program.

0 minute read
0
Write a C program to input number of days from user and convert it to years, weeks and days. How to
convert days to years, weeks in C programming. Logic to convert days to years, weeks and days in C
program.



  1. //hey guys why are you getting more complicated just use this
  2. #include<stdio.h>
  3. int main()
  4. {
  5. int days,months,years,weeks;
  6. printf("\Enenter the days :");
  7. scanf("%d",&days);

  8. years=days/365;
  9. months=days/30;
  10. weeks=days/7;
  11. printf("\nyears :%d\ndays :%d\nmonths :%d\nweeks :%d",years,days,months,weeks);
  12. }


Post a Comment

0Comments
Post a Comment (0)