fork(1) download
  1. #include <stdio.h>
  2. #define MONTHS 12
  3. int main(void)
  4. {
  5.  
  6. int year, month;
  7. int days[2][MONTHS]={{31,28,31,30,31,30,31,31,30,31,30,31},
  8. {31,29,31,30,31,30,31,31,30,31,30,31}};
  9. do{
  10. printf("Input year:\n");
  11. scanf("%d", &year);
  12. printf("Input month:\n");
  13. scanf("%d",&month);
  14. } while(month < 1 || month > 12); if(((year%4==0)&&(year%100!=0))||(year%400==0))
  15. printf("thedayofthismonthis:%d",days[1][month-1]);
  16. else printf("thedayofthismonthis:%d",days[0][month-1]);
  17. return 0;
  18. }
Success #stdin #stdout 0s 544KB
stdin
2000 2
stdout
Input year:
Input month:
thedayofthismonthis:29