fork download
  1. #include<stdio.h>
  2.  
  3. typedef struct{
  4. int year;
  5. int month;
  6. int day;
  7. }Date;
  8.  
  9. Date input_date( Date ymd );
  10. int isLeap( Date days );
  11.  
  12. int main(void)
  13. {
  14. Date date;
  15.  
  16. date = input_date( date );
  17.  
  18. if( isLeap( date ) )
  19. {
  20. printf("%d/%d/%d is a leap.\n", date.year, date.month, date.day );
  21. }
  22. return 0;
  23. }
  24.  
  25. Date input_date( Date ymd )
  26. {
  27. printf("year : "); scanf("%d", &ymd.year );
  28. printf("month : "); scanf("%d", &ymd.month );
  29. printf("day : "); scanf("%d", &ymd.day );
  30.  
  31. return ymd;
  32. }
  33.  
  34. int isLeap( Date days )
  35. {
  36. return ( days.year%4 == 0 && days.year%100 != 0 || days.year%400 == 0 );
  37. }
  38.  
  39.  
Success #stdin #stdout 0s 5284KB
stdin
2024 2 29
stdout
year : month : day : 2024/2/29 is a leap.