You need to sign in or sign up before continuing.×
Ad
Code
Diff
  • 
    int days(int month, int day) {
      int days_elapsed[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
      
        return days_elapsed[month-1] + day;
    }
    
    • int days(int month, int day) {
    • int i;
    • int count = 0;
    • int v[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    • for(i=0;i<month-1;i++) {
    • count+=v[i];
    • }
    • count = count + day;
    • return count;
    • }
    • int days_elapsed[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
    • return days_elapsed[month-1] + day;
    • }