pastebin

Paste Search Dynamic
Recent pastes
days after the date is
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.     int date = 12, month = 11, year = 2022;
  5.  
  6.     int days;
  7.     printf("Enter your days: ");
  8.     scanf("%d",&days);
  9.  
  10.     int newYear = days / 360;
  11.     int newMonth = (days % 360) / 30;
  12.     int newDate = (days % 360) % 30;
  13.  
  14.     date += newDate;
  15.     month += newMonth;
  16.     year += newYear;
  17.  
  18.     if(date > 30){
  19.         date -= 30;
  20.     }
  21.     if(month > 12){
  22.         month -= 12;
  23.     }
  24.  
  25.     printf("%d days after the date is %d days, %d month and %d years", days, date, month, year);
  26.     return 0;
  27. }
Parsed in 0.008 seconds