Dido09

C - Day Converter

May 22nd, 2022 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(){
  5.  
  6. int days, weeks, years;
  7.  
  8. printf("Enter the days: ");
  9. scanf("%d", &days);
  10.  
  11. years = days/365;
  12. weeks = (days%365)/7;
  13. days = days - ((years * 365) + (weeks * 7));
  14.  
  15. printf("Years: %d, Weeks: %d, Days: %d", years, weeks, days);
  16.  
  17.  
  18. return 0;
  19. }
  20.  
Add Comment
Please, Sign In to add comment